Joel Fernandes
unread,Nov 8, 2026, 6:47:27 PM (11 days ago) Nov 8Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to linux-...@vger.kernel.org, Andrey Ryabinin, Alexander Potapenko, Andrey Konovalov, Dmitry Vyukov, Vincenzo Frascino, Andrew Morton, Joel Fernandes, kasa...@googlegroups.com, linu...@kvack.org
rcu_uaf() passes a false protection condition to
rcu_dereference_protected(), which produces a suspicious-RCU-usage
warning before the intended KASAN failure occurs.
The pointer refers to a fresh allocation that has not been published to
readers. State that protection condition explicitly, leaving the intended
tests intact.
Test:
Built with CONFIG_KASAN_KUNIT_TEST=m
Booted Qemu guest (8 CPUs), ran modprobe kasan_test filtered to kasan.*rcu_uaf*
Signed-off-by: Joel Fernandes <
joela...@nvidia.com>
---
mm/kasan/kasan_test_c.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/kasan/kasan_test_c.c b/mm/kasan/kasan_test_c.c
index b9e167ed5be3..4e23765d722c 100644
--- a/mm/kasan/kasan_test_c.c
+++ b/mm/kasan/kasan_test_c.c
@@ -967,8 +967,9 @@ static void rcu_uaf(struct kunit *test)
ptr = kmalloc_obj(struct kasan_rcu_info);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
+ /* The freshly allocated object has not been published to readers. */
global_rcu_ptr = rcu_dereference_protected(
- (struct kasan_rcu_info __rcu *)ptr, NULL);
+ (struct kasan_rcu_info __rcu *)ptr, true);
KUNIT_EXPECT_KASAN_FAIL_READ(test,
call_rcu(&global_rcu_ptr->rcu, rcu_uaf_reclaim);
--
2.54.0