mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: KunWu Chan <kunwu.chan@gmail.com>
Cc: jiangshanlai@gmail.com, paulmck@kernel.org,
	josh@joshtriplett.org, work@onurozkan.dev, frederic@kernel.org,
	neeraj.upadhyay@kernel.org, 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
Subject: Re: [PATCH v2 00/10] rcu: Improve callback diagnostics and validation
Date: Tue, 3 Nov 2026 18:56:43 -0500	[thread overview]
Message-ID: <20261103235643.GA4146834@joelbox> (raw)
In-Reply-To: <CAN_Opa9n-iqRgQczQ5_ZpTMHFbjmW-6+ZYsCgCYdNfuprXLyFw@mail.gmail.com>

On Wed, Oct 28, 2026 at 10:17:25AM +0800, KunWu Chan wrote:
> On Wed, Oct 28, 2026 at 7:13 AM Joel Fernandes <joelagnelf@nvidia.com> wrote:
> >
> > On Tue, Oct 27, 2026 at 03:09:13PM +0800, Kunwu Chan wrote:
> > > Hi,
> > >
> > > This series improves callback diagnostics and validation across RCU,
> > > SRCU, and RCU Tasks.
> > >
> > > Patches 1-3 record callback registration stacks for KASAN in Tree
> > > SRCU, Tiny SRCU, and Tiny RCU.  KASAN prints the recorded auxiliary
> > > stack when reporting a use-after-free.
> > >
> > > Patches 4-6 add rcu_head alignment and NULL callback-function checks.
> > >
> > > Patches 7-10 detect duplicate callback enqueue attempts before
> > > queueing, using the RCU head debug-object mechanism.  A duplicate
> > > registration is rejected at entry and __ratelimit() controls the
> > > diagnostic output group (pr_err, mem_dump_obj, dump_stack).
> > > Detection requires CONFIG_DEBUG_OBJECTS_RCU_HEAD.
> > >
> > > Changes since v1:
> > > - Patches 7-9: __ratelimit() + dump_stack() instead of hard-coded limit
> > > - Patch 10 (new): same change for Tree RCU's rcu_do_enqueue()
> > > - Patch 9: fixed log format to avoid pseudo-function names
> > > - Tags: Reviewed-by (4-6), Suggested-by (7-10)
> > > - v1: https://lore.kernel.org/all/20261023101841.2910719-1-kunwu.chan@gmail.com/
> > >
> > >
> > > Testing:
> > >   rcutorture with KASAN (SRCU-N, SRCU-P, SRCU-T, SRCU-U, TINY01,
> > >   TINY02, TREE03, 3min each): all exitcode 0.
> > >
> > >   KASAN aux stack (QEMU, CONFIG_KASAN_GENERIC=y):
> > >     Last potentially related work creation:
> > >      kasan_save_stack+0x33/0x60
> > >      kasan_record_aux_stack+0x8c/0xa0
> > >      call_srcu+0xb2/0x390
> > >
> > >   Duplicate enqueue (QEMU, CONFIG_DEBUG_OBJECTS_RCU_HEAD=y):
> > >     call_srcu(): Duplicate call_srcu() CB ... ->cb
> > >     dump_stack_lvl+0x47/0x60
> > >     call_rcu_tasks_generic(): Duplicate CB for RCU Tasks, ... ->cb
> > >     dump_stack_lvl+0x47/0x60
> > >     rcu_do_enqueue(): Double-freed CB ... ->cb  slab kmalloc-16 ...
> > >
> > >
> > > Kunwu Chan (10):
> > >   srcu: Record callback registration stack for KASAN
> > >   srcutiny: Record callback registration stack for KASAN
> > >   rcu: Record callback registration stack for Tiny RCU
> > >   srcu: Validate callback arguments
> > >   rcu: Validate callback arguments in Tiny RCU
> > >   rcu-tasks: Validate callback arguments
> > >   srcu: Detect duplicate callback enqueue at registration
> > >   srcutiny: Detect duplicate callback enqueue
> > >   rcu-tasks: Detect duplicate callback enqueue
> > >   rcu: Improve duplicate callback diagnostics
> >
> >
> > Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
> 
> Thanks, Joel.
> 
> >
> > All look good to me, applying for further testing and review for 7.5. Did you
> > also test double-call-srcu and confirm intended behavior? Thanks!
> >
> 
> Yes, I tested double call_srcu() under QEMU with
> CONFIG_DEBUG_OBJECTS_RCU_HEAD=y.
> Both Tree SRCU (direct and deferred paths) and Tiny SRCU triggered the expected
> duplicate-enqueue diagnostic with the callback symbol and dump_stack() output.

Great!

> 
> BTW, I'm working on follow-up rcutorture support for
> duplicate-callback testing and
> KASAN aux-stack verification.

Nice! How is that coming along?

thanks,

Joel Fernandes


> 
> Thanks for review.
> Kunwu
> 
> > thanks,
> >
> > Joel Fernandes
> >
> >
> > >
> > >  kernel/rcu/srcutiny.c | 34 ++++++++++++++++++++++++++++++++++
> > >  kernel/rcu/srcutree.c | 36 ++++++++++++++++++++++++++++++------
> > >  kernel/rcu/tasks.h    | 27 +++++++++++++++++++++++++++
> > >  kernel/rcu/tiny.c     | 11 +++++++++++
> > >  kernel/rcu/tree.c     |  9 +++++++--
> > >  5 files changed, 109 insertions(+), 8 deletions(-)
> > >
> > >
> > > base-commit: 940793b926aa94bf65ec404043050888e3053188
> > > --
> > > 2.43.0
> > >

      reply	other threads:[~2026-11-03 23:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27  7:09 Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 01/10] srcu: Record callback registration stack for KASAN Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 02/10] srcutiny: " Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 03/10] rcu: Record callback registration stack for Tiny RCU Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 04/10] srcu: Validate callback arguments Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 05/10] rcu: Validate callback arguments in Tiny RCU Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 06/10] rcu-tasks: Validate callback arguments Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 07/10] srcu: Detect duplicate callback enqueue at registration Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 08/10] srcutiny: Detect duplicate callback enqueue Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 09/10] rcu-tasks: " Kunwu Chan
2026-10-27  7:09 ` [PATCH v2 10/10] rcu: Improve duplicate callback diagnostics Kunwu Chan
2026-10-27 23:13 ` [PATCH v2 00/10] rcu: Improve callback diagnostics and validation Joel Fernandes
2026-10-28  2:17   ` KunWu Chan
2026-11-03 23:56     ` Joel Fernandes [this message]

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=20261103235643.GA4146834@joelbox \
    --to=joelagnelf@nvidia.com \
    --cc=boqun@kernel.org \
    --cc=frederic@kernel.org \
    --cc=jiangshanlai@gmail.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=paulmck@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®