From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, andreyknvl@gmail.com,
aryabinin@virtuozzo.com, eberman@codeaurora.org,
elver@google.com, glider@google.com, linux-mm@kvack.org,
mm-commits@vger.kernel.org, torvalds@linux-foundation.org,
vincenzo.frascino@arm.com
Subject: [patch 05/10] kasan: slab: always reset the tag in get_freepointer_safe()
Date: Sat, 22 May 2021 17:41:56 -0700 [thread overview]
Message-ID: <20210523004156.1-UnZ7NxI%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210522174113.47fd4c853c0a1470c57deefa@linux-foundation.org>
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);
_
next prev parent reply other threads:[~2021-05-23 0:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-23 0:41 incoming Andrew Morton
2021-05-23 0:41 ` [patch 01/10] mm/shuffle: fix section mismatch warning Andrew Morton
2021-05-23 0:41 ` [patch 02/10] Revert "mm/gup: check page posion status for coredump." Andrew Morton
2021-05-23 0:41 ` [patch 03/10] ipc/mqueue, msg, sem: avoid relying on a stack reference past its expiry Andrew Morton
2021-05-23 0:41 ` [patch 04/10] tools/testing/selftests/exec: fix link error Andrew Morton
2021-05-23 0:41 ` Andrew Morton [this message]
2021-05-23 0:41 ` [patch 06/10] watchdog: reliable handling of timestamps Andrew Morton
2021-05-23 0:42 ` [patch 07/10] linux/bits.h: fix compilation error with GENMASK Andrew Morton
2021-05-23 0:42 ` [patch 08/10] proc: remove Alexey from MAINTAINERS Andrew Morton
2021-05-23 0:42 ` [patch 09/10] lib: kunit: suppress a compilation warning of frame size Andrew Morton
2021-05-23 0:42 ` [patch 10/10] userfaultfd: hugetlbfs: fix new flag usage in error path Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210523004156.1-UnZ7NxI%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=aryabinin@virtuozzo.com \
--cc=eberman@codeaurora.org \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=vincenzo.frascino@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox