From: "Paul E. McKenney" <paulmck@kernel.org>
To: Kunwu Chan <kunwu.chan@gmail.com>
Cc: jiangshanlai@gmail.com, josh@joshtriplett.org,
work@onurozkan.dev, frederic@kernel.org,
neeraj.upadhyay@kernel.org, joelagnelf@nvidia.com,
boqun@kernel.org, urezki@gmail.com, rostedt@goodmis.org,
mathieu.desnoyers@efficios.com, qiang.zhang@linux.dev,
rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
Kunwu Chan <chentao@kylinos.cn>
Subject: Re: [PATCH 1/9] srcu: Record callback registration stack for KASAN
Date: Fri, 23 Oct 2026 12:41:06 -0700 [thread overview]
Message-ID: <ee221d82-c064-4db8-bf85-3acc2e70b983@paulmck-laptop> (raw)
In-Reply-To: <20261023101841.2910719-2-kunwu.chan@gmail.com>
On Fri, Oct 23, 2026 at 06:18:33PM +0800, Kunwu Chan wrote:
> Record the callback registration stack in __call_srcu()
> for KASAN diagnostics involving SRCU callbacks.
>
> Suggested-by: Zqiang <qiang.zhang@linux.dev>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
For 1/9-3/9, looks good if there is a kasan_print_aux_stacks() called
somewhere from 7/9-9/9. I am not seeing it, but then again, I do not
claim to be a KASAN expert.
Thanx, Paul
> ---
> kernel/rcu/srcutree.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index 2b0e2b2d2c18..46fe2f0cef85 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -20,6 +20,7 @@
> #include <linux/percpu.h>
> #include <linux/preempt.h>
> #include <linux/irq_work.h>
> +#include <linux/kasan.h>
> #include <linux/llist.h>
> #include <linux/rcupdate_wait.h>
> #include <linux/sched.h>
> @@ -1530,6 +1531,10 @@ static void __call_srcu(struct srcu_struct *ssp, struct rcu_head *rhp,
> {
> if (WARN_ON_ONCE(ssp->srcu_reader_flavor == SRCU_READ_FLAVOR_ATOMIC))
> return; // Leak the callback rather than corrupt SRCU state.
> +
> + /* Record the caller: the irq_work's stack says nothing about it. */
> + kasan_record_aux_stack(rhp);
> +
> if (should_rcu_defer()) {
> struct srcu_defer *sndp = this_cpu_ptr(&srcu_defer);
> struct srcu_data *sdp;
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-10-23 19:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 10:18 [PATCH 0/9] rcu: Improve callback diagnostics and validation Kunwu Chan
2026-10-23 10:18 ` [PATCH 1/9] srcu: Record callback registration stack for KASAN Kunwu Chan
2026-10-23 19:41 ` Paul E. McKenney [this message]
2026-10-26 2:02 ` KunWu Chan
2026-10-23 10:18 ` [PATCH 2/9] srcutiny: " Kunwu Chan
2026-10-23 10:18 ` [PATCH 3/9] rcu: Record callback registration stack for Tiny RCU Kunwu Chan
2026-10-23 10:18 ` [PATCH 4/9] srcu: Validate callback arguments Kunwu Chan
2026-10-23 19:39 ` Paul E. McKenney
2026-10-23 10:18 ` [PATCH 5/9] rcu: Validate callback arguments in Tiny RCU Kunwu Chan
2026-10-23 10:18 ` [PATCH 6/9] rcu-tasks: Validate callback arguments Kunwu Chan
2026-10-23 10:18 ` [PATCH 7/9] srcu: Detect duplicate callback enqueue at registration Kunwu Chan
2026-10-23 19:30 ` Paul E. McKenney
2026-10-23 19:38 ` Paul E. McKenney
2026-10-26 2:35 ` KunWu Chan
2026-10-26 23:31 ` Paul E. McKenney
2026-10-23 10:18 ` [PATCH 8/9] srcutiny: Detect duplicate callback enqueue Kunwu Chan
2026-10-23 19:31 ` Paul E. McKenney
2026-10-26 2:36 ` KunWu Chan
2026-10-23 10:18 ` [PATCH 9/9] rcu-tasks: " Kunwu Chan
2026-10-23 19:31 ` Paul E. McKenney
2026-10-26 2:36 ` KunWu Chan
2026-10-26 23:31 ` Paul E. McKenney
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=ee221d82-c064-4db8-bf85-3acc2e70b983@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=boqun@kernel.org \
--cc=chentao@kylinos.cn \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=kunwu.chan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=neeraj.upadhyay@kernel.org \
--cc=qiang.zhang@linux.dev \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=urezki@gmail.com \
--cc=work@onurozkan.dev \
/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
all inboxes | Powered by JetHome®