From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,vincenzo.frascino@arm.com,ryabinin.a.a@gmail.com,mpe@ellerman.id.au,glider@google.com,dvyukov@google.com,andreyknvl@gmail.com,bgray@linux.ibm.com,akpm@linux-foundation.org
Subject: [merged mm-hotfixes-stable] kasan-guard-release_free_meta-shadow-access-with-kasan_arch_is_ready.patch removed from -mm tree
Date: Tue, 20 Feb 2024 14:22:37 -0800 [thread overview]
Message-ID: <20240220222237.B9504C43390@smtp.kernel.org> (raw)
The quilt patch titled
Subject: kasan: guard release_free_meta() shadow access with kasan_arch_is_ready()
has been removed from the -mm tree. Its filename was
kasan-guard-release_free_meta-shadow-access-with-kasan_arch_is_ready.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Benjamin Gray <bgray@linux.ibm.com>
Subject: kasan: guard release_free_meta() shadow access with kasan_arch_is_ready()
Date: Tue, 13 Feb 2024 14:39:58 +1100
release_free_meta() accesses the shadow directly through the path
kasan_slab_free
__kasan_slab_free
kasan_release_object_meta
release_free_meta
kasan_mem_to_shadow
There are no kasan_arch_is_ready() guards here, allowing an oops when the
shadow is not initialized. The oops can be seen on a Power8 KVM guest.
This patch adds the guard to release_free_meta(), as it's the first level
that specifically requires the shadow.
It is safe to put the guard at the start of this function, before the
stack put: only kasan_save_free_info() can initialize the saved stack,
which itself is guarded with kasan_arch_is_ready() by its caller
poison_slab_object(). If the arch becomes ready before
release_free_meta() then we will not observe KASAN_SLAB_FREE_META in the
object's shadow, so we will not put an uninitialized stack either.
Link: https://lkml.kernel.org/r/20240213033958.139383-1-bgray@linux.ibm.com
Fixes: 63b85ac56a64 ("kasan: stop leaking stack trace handles")
Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/kasan/generic.c | 3 +++
1 file changed, 3 insertions(+)
--- a/mm/kasan/generic.c~kasan-guard-release_free_meta-shadow-access-with-kasan_arch_is_ready
+++ a/mm/kasan/generic.c
@@ -522,6 +522,9 @@ static void release_alloc_meta(struct ka
static void release_free_meta(const void *object, struct kasan_free_meta *meta)
{
+ if (!kasan_arch_is_ready())
+ return;
+
/* Check if free meta is valid. */
if (*(u8 *)kasan_mem_to_shadow(object) != KASAN_SLAB_FREE_META)
return;
_
Patches currently in -mm which might be from bgray@linux.ibm.com are
reply other threads:[~2024-02-20 22:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240220222237.B9504C43390@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=bgray@linux.ibm.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=mm-commits@vger.kernel.org \
--cc=mpe@ellerman.id.au \
--cc=ryabinin.a.a@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.