From patchwork Tue Jul 30 18:49:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danilo Krummrich X-Patchwork-Id: 13747779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79174C49EA1 for ; Tue, 30 Jul 2024 18:51:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C8B506B0085; Tue, 30 Jul 2024 14:51:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B76B76B0089; Tue, 30 Jul 2024 14:51:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A17076B008A; Tue, 30 Jul 2024 14:51:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 81A3F6B0085 for ; Tue, 30 Jul 2024 14:51:00 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 34025A0447 for ; Tue, 30 Jul 2024 18:51:00 +0000 (UTC) X-FDA: 82397311080.25.8062DEF Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id 7CE2D14000A for ; Tue, 30 Jul 2024 18:50:58 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MaVod01S; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722365417; a=rsa-sha256; cv=none; b=4AXBR59kmq5vNFllTJ2Z44EmWwG8zERdbL12B1IBBifX3ZkBlDHkdsbZgFfwnoPNzSoNe8 En4y+XipGWfgUCJpYPBpIB9nACwNxc71pmAp7H1JHKWvXZFvcH9kD+ZxgwRR2CAc3pt7Rz zxOh5Qi958ZPbWt+mvFwlQekkPig/jA= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=MaVod01S; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf23.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722365417; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yIgIvlGX5TcMoH+qnhpq+tghEwRjhrL3nwgRdBJ9NMU=; b=ft743mp74FD2O4P7bN8rWleiLhhTYMqs2kc1cG2tNiBpbNYwQOFGr4elmIlIoU0FTl4SPE 83TMgaN1ZXRy8Pk71EhTFbSr3MSL46V1hkyx8GIMdAmE7pp3ZRW07A/6JSzC/Q83xbiGpp K2BbOgAroD3M9SK8acIdKwVD7pAAd1s= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 86D1E6203E; Tue, 30 Jul 2024 18:50:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85885C4AF0B; Tue, 30 Jul 2024 18:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722365457; bh=B7lCvXux7f94TaAbBTbtx+OfILAdRrodvDeXA9EjfZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MaVod01SJZfxHuSLw4OhC4FdwSCUEEQ47Ao5XAdKEYBAi63urmfePKXZ23RqHviS5 mrhutwU2sUgZIg2tN/SyHx0zfVxqx0G4o0kof5Qe5uO8Y9sr+bI9FKnJgN7EojkVIs /Hp6cFAR5/0dCpDgIQMcTtXtH2A8x8JeP8GzIdp3gayBj2E7Y1CtTRCeWMfTj4KYY9 aeZzPqkrdUN8Gl6j7iLrRJ7YpJmypGPJzR8cIzDmn1Kikt88N+GTzvZOIsxL7I2Aok Z2gTQoXD5fAeVxahAeb/LeYpXEKxzQYOlBg4JYaa5mXN5VDaEpxETu2uNsmx/KIHfI PLWrlUUOHwrNg== From: Danilo Krummrich To: akpm@linux-foundation.org, urezki@gmail.com, hch@infradead.org, vbabka@suse.cz Cc: mhocko@suse.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Danilo Krummrich Subject: [PATCH 1/4] mm: kvrealloc: disable KASAN when switching to vmalloc Date: Tue, 30 Jul 2024 20:49:41 +0200 Message-ID: <20240730185049.6244-2-dakr@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730185049.6244-1-dakr@kernel.org> References: <20240730185049.6244-1-dakr@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7CE2D14000A X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: yqwj7dp6cipykwqhgdi4tj669r1889tc X-HE-Tag: 1722365458-813207 X-HE-Meta: U2FsdGVkX1+Q9AyaJpwURAMzta5Y2WbZajaGJNFIDr2nmNh0py2Nfo7+pVn7RNV6j8tCzlGD8dmWcjnKA9EC92gej7mmUfQv9zK7wd8Z0wfYQI9yFFLJ8NX5t//rWG7KnNRNMUFuQc0yy3+27AhYzqem/YrkV//hrAaXYCj/GdEkYHGEVa50nHNGSLIGfLj3imHOihAi2SJarygTcJdlYIm1MPTXMWzGAusQArQZ+DC728Z6zN0zOMVwQJC5plXOM93nfzFKxxwTuw0J4QIwB4fVAzgYLJGvhGbxOFO6oAsVnWCvC/WKmyHRrluFxwmITeT5vjEDKcnBwT2y3oqNIqHl+WFvomE2jgF45t3lDtKIUcE5RAU0thMS+MBu0Nx/6ual2nx3fnaZLf/Na+Pa9jQEMJ5lmNr2PYAzzoZ/epYaf42njnv0Wlzu5dkAifcdLXBTzd2Mdj6LyzbGE9JNQMN4SL/cdq7HwjHkL/oncw3ysglnpt6+oYlCkDCe3PAxHC9GhCvKCQFETAI048IEmCGV1r5jecIAiy1i33LoJMQ/9nU/TGh5v/ddtdDj8uKaavWBVHqTePZ0+uPpOYIxAJw88Be6a1L+z+gdmci3tiyTgCNC01wE7RkFpLuHiUu+U4n7RNO43TGWBg/gPCjCLl4TUA1gh99SUs9tFbvt0aTM4YjC3N0oJO99q8YTakKmqtJJd7cbDazzs9QiC7vPiw2mgl31twyEQsG7zWFV6nFOUBacEekheBasEXR8id6MhOKCGcSjNiXHpcaMdBT3eCfiDAEruUIowQDyfq2nXAd8bI+/9DZSFyWiRqUEPZMxVi9KVDcK99jlQJiVwJGGG3kLBvQAnhapZTeNKBeXa+5JIAyO/0NcShbkAReacAD1QbHrbhtzo2aHP0p9v3KwyoQ+8bzyxpPleglg/DltfzUrnx68M7BPwXxEdxmpFmmthY+z7yyYfM6jDzEZ17X YJDY91iY FSfdggCxuegBT5cHrFdo/J5vcZDDBlqQ7DqOWoj8KGS+XKCOHtaCzwt9j9oBek9g6sgOiiBiHDlLdb0EyA6XN+ZK4sPxpLU0RtquqtW6TrwMIWJmRU1eytiMNeiqhgdxP/Hd6o+Ft7K7zNAsqvsVuGOLoueazg+pBirMp9jSU0z4SB4ewhU3YK33NCD0Kx7vwVwutwWa7KRdNTwPgbMwDgf1Q0I1E9oJSt111kR0qf29fDuU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Disable KASAN accessibility checks when switching from a kmalloc buffer to a vmalloc buffer. Fixes: 923a26b4c679 ("mm: kvmalloc: align kvrealloc() with krealloc()") Signed-off-by: Danilo Krummrich --- mm/util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/util.c b/mm/util.c index 29ae93f6344f..bfb2d69b6434 100644 --- a/mm/util.c +++ b/mm/util.c @@ -753,7 +753,10 @@ void *kvrealloc_noprof(const void *p, size_t size, gfp_t flags) if (p) { /* We already know that `p` is not a vmalloc address. */ - memcpy(n, p, ksize(p)); + kasan_disable_current(); + memcpy(n, kasan_reset_tag(p), ksize(p)); + kasan_enable_current(); + kfree(p); } }