mm-slub-disable-kmsan-when-checking-the-padding-bytes.patch removed from -mm tree
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 <[email protected]>
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.
---
mm/slub.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
mm/slub.c renamed from mm/slub.c~mm-slub-disable-kmsan-when-checking-the-padding-bytes +12 -4
@@ -1176,9 +1176,16 @@ static void restore_bytes(struct kmem_camemset (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 [email protected] are