Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63262BE47 for ; Sat, 29 Jun 2024 02:30:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719628258; cv=none; b=UOrnjehdmYcuNy0IfB6R0CVHCta851J5B0TZW34BwsaGaPCFq83jSMe/WejZNcOzZGM0EpvodGSvioNTqm8KfZnJbkN5Gg723PvT+8820xcf/FjThLNNFbTHP9EWhFm1UQsjxBoy6k34Vmn+ugGR43TUemyCjQ5j57ksf/Ho9FI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719628258; c=relaxed/simple; bh=x84KfDbbGlKHo63uoEueavo+/ksGMfv6d2/b8mtkuF4=; h=Date:To:From:Subject:Message-Id; b=E7LNYYOTS6i+QAdsUTJL/fFZRoUxgcRRgO8c19p+Zt9TEGn0Ax9l5RlTpyKwTJ/RsS4lG4lojgWRBFGHVl40FO7U7c2eTGWpdV8Ex3SOvBVfgNR6OQ/o0iMxufSqw03K4aMWpGmSpdM2JtbPKTXRLNeKTZ9Fc4Ao+F6Kb284k0Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=zNqN5gaS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="zNqN5gaS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39A77C116B1; Sat, 29 Jun 2024 02:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1719628258; bh=x84KfDbbGlKHo63uoEueavo+/ksGMfv6d2/b8mtkuF4=; h=Date:To:From:Subject:From; b=zNqN5gaSpFXl+kis1gPvvvb2dKPggkctJQkc/I0uqaeJy3wiS1uQDdk0ohp8NTy2F JowJcRcpGtkEk1xnIXlvYovn1iS+Sk+8c+fognC59QKUuHKUs+Io1u2Vj3hL3LqWoF EnfXoxU/Hf/r/80SVzyUxEgzEkM9yflO0rSsf+Wc= Date: Fri, 28 Jun 2024 19:30:57 -0700 To: mm-commits@vger.kernel.org,vbabka@suse.cz,svens@linux.ibm.com,rostedt@goodmis.org,roman.gushchin@linux.dev,rientjes@google.com,penberg@kernel.org,mhiramat@kernel.org,mark.rutland@arm.com,kasan-dev@googlegroups.com,iamjoonsoo.kim@lge.com,hca@linux.ibm.com,gor@linux.ibm.com,glider@google.com,elver@google.com,dvyukov@google.com,cl@linux.com,borntraeger@linux.ibm.com,agordeev@linux.ibm.com,42.hyeyoo@gmail.com,iii@linux.ibm.com,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-stable] mm-slub-disable-kmsan-when-checking-the-padding-bytes.patch removed from -mm tree Message-Id: <20240629023058.39A77C116B1@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: mm: slub: disable KMSAN when checking the padding bytes has been removed from the -mm tree. Its filename was mm-slub-disable-kmsan-when-checking-the-padding-bytes.patch This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: Ilya Leoshkevich Subject: mm: slub: disable KMSAN when checking the padding bytes Date: Fri, 21 Jun 2024 13:35:02 +0200 Even though the KMSAN warnings generated by memchr_inv() are suppressed by metadata_access_enable(), its return value may still be poisoned. The reason is that the last iteration of memchr_inv() returns `*start != value ? start : NULL`, where *start is poisoned. Because of this, somewhat counterintuitively, the shadow value computed by visitSelectInst() is equal to `(uintptr_t)start`. One possibility to fix this, since the intention behind guarding memchr_inv() behind metadata_access_enable() is to touch poisoned metadata without triggering KMSAN, is to unpoison its return value. However, this approach is too fragile. So simply disable the KMSAN checks in the respective functions. Link: https://lkml.kernel.org/r/20240621113706.315500-19-iii@linux.ibm.com Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko Cc: Alexander Gordeev Cc: Christian Borntraeger Cc: Christoph Lameter Cc: David Rientjes Cc: Dmitry Vyukov Cc: Heiko Carstens Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Joonsoo Kim Cc: Cc: Marco Elver Cc: Mark Rutland Cc: Masami Hiramatsu (Google) Cc: Pekka Enberg Cc: Roman Gushchin Cc: Steven Rostedt (Google) Cc: Sven Schnelle Cc: Vasily Gorbik Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- mm/slub.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/mm/slub.c~mm-slub-disable-kmsan-when-checking-the-padding-bytes +++ a/mm/slub.c @@ -1176,9 +1176,16 @@ static void restore_bytes(struct kmem_ca memset(from, data, to - from); } -static int check_bytes_and_report(struct kmem_cache *s, struct slab *slab, - u8 *object, char *what, - u8 *start, unsigned int value, unsigned int bytes) +#ifdef CONFIG_KMSAN +#define pad_check_attributes noinline __no_kmsan_checks +#else +#define pad_check_attributes +#endif + +static pad_check_attributes int +check_bytes_and_report(struct kmem_cache *s, struct slab *slab, + u8 *object, char *what, + u8 *start, unsigned int value, unsigned int bytes) { u8 *fault; u8 *end; @@ -1270,7 +1277,8 @@ static int check_pad_bytes(struct kmem_c } /* Check the pad bytes at the end of a slab page */ -static void slab_pad_check(struct kmem_cache *s, struct slab *slab) +static pad_check_attributes void +slab_pad_check(struct kmem_cache *s, struct slab *slab) { u8 *start; u8 *fault; _ Patches currently in -mm which might be from iii@linux.ibm.com are