From: Kuniyuki Iwashima <kuniyu@google.com>
To: Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@kernel.org>,
Harry Yoo <harry@kernel.org>
Cc: Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
kasan-dev@googlegroups.com, linux-mm@kvack.org,
Kuniyuki Iwashima <kuniyu@google.com>
Subject: [PATCH v3 0/2] mm/kasan: Detect double-free involving kfree_rcu_sheaf().
Date: Wed, 28 Oct 2026 19:39:18 +0000 [thread overview]
Message-ID: <20261028194014.3671161-1-kuniyu@google.com> (raw)
Recently, syzbot has reported several weird use-after-free splats.
What they have in common is that "Freed by" points to rcu_free_sheaf(),
whereas the object shown in "Call Trace:" and "Allocated by" is never
supposed to be freed via kfree_rcu().
This means the object was a victim of a double-free somewhere else and
was silently poisoned by rcu_free_sheaf() after being reallocated.
This happens because kfree_rcu_sheaf() queues an object into the RCU
sheaf without invoking any KASAN hooks.
This series enables KASAN to detect double-free involving
kfree_rcu_sheaf() immediately and adds KUnit tests for it.
Changes:
v3:
* Collect Alexander and Andrey tags
* Patch 2
* Move migrate_disable() before p = kmem_cache_alloc()
* add KASAN_TEST_NEEDS_CONFIG_OFF() for PREEMPT_RT
v2: https://lore.kernel.org/linux-mm/20261027222557.1072105-1-kuniyu@google.com/
* Patch 1
* Collect Vlastimil and Alexander tags
* Add Fixes tag
* Add kdoc for @after_rcu_delay of kasan_slab_pre_free()
* Rename s/kasan_record_aux_stack_rcu/kasan_mark_rcu_free_pending/g
* Add comment for __kasan_record_aux_stack()
* Patch 2
* Move kasan_byte_accessible() check and
kvfree_rcu_barrier_on_cache() after switch
v1: https://lore.kernel.org/linux-mm/20261009214639.2878857-1-kuniyu@google.com/
Kuniyuki Iwashima (2):
mm/kasan: Detect double-free involving kfree_rcu_sheaf().
mm/kasan/kunit: Add double-free tests involving kfree_rcu_sheaf().
include/linux/kasan.h | 15 +++--
mm/kasan/common.c | 13 ++--
mm/kasan/generic.c | 17 ++++-
mm/kasan/kasan.h | 34 +++++++++-
mm/kasan/kasan_test_c.c | 139 ++++++++++++++++++++++++++++++++++++++++
mm/slub.c | 13 +++-
6 files changed, 217 insertions(+), 14 deletions(-)
--
2.56.0.313.g2479322e68-goog
next reply other threads:[~2026-10-28 19:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 19:39 Kuniyuki Iwashima [this message]
2026-10-28 19:39 ` [PATCH v3 1/2] mm/kasan: Detect double-free involving kfree_rcu_sheaf() Kuniyuki Iwashima
2026-10-29 14:07 ` Harry Yoo
2026-10-29 19:27 ` Kuniyuki Iwashima
2026-10-28 19:39 ` [PATCH v3 2/2] mm/kasan/kunit: Add double-free tests " Kuniyuki Iwashima
2026-10-29 4:46 ` Andrew Morton
2026-10-29 4:51 ` Kuniyuki Iwashima
2026-10-29 13:53 ` Harry Yoo
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=20261028194014.3671161-1-kuniyu@google.com \
--to=kuniyu@google.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=cl@gentwo.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=ryabinin.a.a@gmail.com \
--cc=vbabka@kernel.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