mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + kasan-slab-always-reset-the-tag-in-get_freepointer_safe.patch added to -mm tree
@ 2021-05-14 22:26 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-05-14 22:26 UTC (permalink / raw)
  To: andreyknvl, aryabinin, eberman, elver, glider, mm-commits,
	vincenzo.frascino


The patch titled
     Subject: kasan: slab: always reset the tag in get_freepointer_safe()
has been added to the -mm tree.  Its filename is
     kasan-slab-always-reset-the-tag-in-get_freepointer_safe.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/kasan-slab-always-reset-the-tag-in-get_freepointer_safe.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/kasan-slab-always-reset-the-tag-in-get_freepointer_safe.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Alexander Potapenko <glider@google.com>
Subject: kasan: slab: always reset the tag in get_freepointer_safe()

With CONFIG_DEBUG_PAGEALLOC enabled, the kernel should also untag the
object pointer, as done in get_freepointer().

Failing to do so reportedly leads to SLUB freelist corruptions that
manifest as boot-time crashes.

Link: https://lkml.kernel.org/r/20210514072228.534418-1-glider@google.com
Signed-off-by: Alexander Potapenko <glider@google.com>
Cc: Marco Elver <elver@google.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Elliot Berman <eberman@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/slub.c |    1 +
 1 file changed, 1 insertion(+)

--- a/mm/slub.c~kasan-slab-always-reset-the-tag-in-get_freepointer_safe
+++ a/mm/slub.c
@@ -301,6 +301,7 @@ static inline void *get_freepointer_safe
 	if (!debug_pagealloc_enabled_static())
 		return get_freepointer(s, object);
 
+	object = kasan_reset_tag(object);
 	freepointer_addr = (unsigned long)object + s->offset;
 	copy_from_kernel_nofault(&p, (void **)freepointer_addr, sizeof(p));
 	return freelist_ptr(s, p, freepointer_addr);
_

Patches currently in -mm which might be from glider@google.com are

kasan-slab-always-reset-the-tag-in-get_freepointer_safe.patch
printk-introduce-dump_stack_lvl.patch
kasan-use-dump_stack_lvlkern_err-to-print-stacks.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-14 22:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14 22:26 + kasan-slab-always-reset-the-tag-in-get_freepointer_safe.patch added to -mm tree akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).