[PATCH 2/9] srcutiny: Record callback registration stack for KASAN
From: Kunwu Chan
Date: Fri Oct 23 2026 - 06:20:00 EST
Record the callback registration stack in call_srcu()
for KASAN diagnostics involving Tiny SRCU callbacks.
Suggested-by: Zqiang <qiang.zhang@xxxxxxxxx>
Signed-off-by: Kunwu Chan <chentao@xxxxxxxxxx>
---
kernel/rcu/srcutiny.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/rcu/srcutiny.c b/kernel/rcu/srcutiny.c
index 63a3f0a8bc53..3ee28885b96f 100644
--- a/kernel/rcu/srcutiny.c
+++ b/kernel/rcu/srcutiny.c
@@ -10,6 +10,7 @@
#include <linux/export.h>
#include <linux/irq_work.h>
+#include <linux/kasan.h>
#include <linux/llist.h>
#include <linux/mutex.h>
#include <linux/preempt.h>
@@ -290,6 +291,9 @@ EXPORT_SYMBOL_GPL(srcu_defer_drain);
void call_srcu(struct srcu_struct *ssp, struct rcu_head *rhp,
rcu_callback_t func)
{
+ /* Record the caller: the irq_work's stack says nothing about it. */
+ kasan_record_aux_stack(rhp);
+
if (should_rcu_defer()) {
/* A re-entrant call_srcu() during the drain would livelock it. */
if (READ_ONCE(srcu_defer_draining) && !in_nmi()) {
--
2.43.0