mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: "fuwenxin@linux.alibaba.com" <fuwenxin@linux.alibaba.com>
Cc: "paulmck@kernel.org" <paulmck@kernel.org>,
	"frederic@kernel.org" <frederic@kernel.org>,
	"dave@stgolabs.net" <dave@stgolabs.net>,
	"josh@joshtriplett.org" <josh@joshtriplett.org>,
	"neeraj.upadhyay@kernel.org" <neeraj.upadhyay@kernel.org>,
	"boqun@kernel.org" <boqun@kernel.org>,
	"urezki@gmail.com" <urezki@gmail.com>,
	"rcu@vger.kernel.org" <rcu@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"mathieu.desnoyers@efficios.com" <mathieu.desnoyers@efficios.com>,
	"jiangshanlai@gmail.com" <jiangshanlai@gmail.com>,
	"qiang.zhang@linux.dev" <qiang.zhang@linux.dev>,
	"oliver.yang@linux.alibaba.com" <oliver.yang@linux.alibaba.com>,
	"xlpang@linux.alibaba.com" <xlpang@linux.alibaba.com>
Subject: Re: [PATCH] rcutorture: Fix busted_srcud crash on module unload
Date: Mon, 19 Oct 2026 06:01:21 +0000	[thread overview]
Message-ID: <C84B6EDC-B669-4E37-B9D4-ADA6B76DC9F9@nvidia.com> (raw)
In-Reply-To: <20261019023644.2750352-1-fuwenxin@linux.alibaba.com>



> On Oct 18, 2026, at 10:36 PM, fuwenxin@linux.alibaba.com wrote:
> 
> From: Fu Wenxin <fuwenxin@linux.alibaba.com>
> 
> Commit e4ed20c1603c ("rcutorture: Exercise DEFINE_STATIC_SRCU_FAST() and
> init_srcu_struct_fast()") split SRCU torture initialization into two
> helpers: srcu_torture_init(), which now only points srcu_ctlp at the
> static srcu_ctl/srcu_ctlf/srcu_ctlfud structures, and the new
> srcud_torture_init(), which calls init_srcu_struct(&srcu_ctld) for the
> dynamically allocated srcu_ctld.
> 
> That commit updated srcud_ops to use srcud_torture_init(), but left
> busted_srcud_ops pairing .init = srcu_torture_init (static srcu_ctl) with
> .cleanup = srcu_torture_cleanup (which unconditionally calls
> cleanup_srcu_struct(&srcu_ctld)). As a result srcu_ctld is never
> initialized when running torture_type=busted_srcud, yet it is torn down
> at module unload.
> 
> cleanup_srcu_struct() then dereferences ssp->srcu_sup, which is still
> NULL for the zero-initialized srcu_ctld, and faults on the ->lock field
> accessed by raw_spin_lock_irq_rcu_node():
> 
>  Unable to handle kernel paging request at virtual address dfff80000000001b
>  ...
>  el1_abort -> do_translation_fault -> do_bad_area -> die_kernel_fault
> 
> (The fault address is the KASAN shadow of NULL + offsetof(srcu_usage,
> lock) == 0xd8.)
> 
> This is trivially reproducible:
> 
>  modprobe rcutorture torture_type=busted_srcud
>  sleep 45
>  rmmod rcutorture    # panic here
> 
> Fix it by making busted_srcud_ops initialize the same srcu_ctld that its
> cleanup handler tears down, matching srcud_ops.
> 
> Fixes: e4ed20c1603c ("rcutorture: Exercise DEFINE_STATIC_SRCU_FAST() and init_srcu_struct_fast()")
> Signed-off-by: Fu Wenxin <fuwenxin@linux.alibaba.com>

Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>

Applying for 7.5, thanks.



> ---
> kernel/rcu/rcutorture.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
> index 8a9282a0245cc..7cc78da1356f9 100644
> --- a/kernel/rcu/rcutorture.c
> +++ b/kernel/rcu/rcutorture.c
> @@ -991,7 +991,7 @@ static struct rcu_torture_ops srcud_ops = {
> /* As above, but broken due to inappropriate reader extension. */
> static struct rcu_torture_ops busted_srcud_ops = {
>    .ttype        = SRCU_FLAVOR,
> -    .init        = srcu_torture_init,
> +    .init        = srcud_torture_init,
>    .cleanup    = srcu_torture_cleanup,
>    .readlock    = srcu_torture_read_lock,
>    .read_delay    = rcu_read_delay,
> --
> 2.43.7
> 

  reply	other threads:[~2026-10-19  6:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  2:36 fuwenxin
2026-10-19  6:01 ` Joel Fernandes [this message]
2026-10-19  6:29 ` Bradley Morgan

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=C84B6EDC-B669-4E37-B9D4-ADA6B76DC9F9@nvidia.com \
    --to=joelagnelf@nvidia.com \
    --cc=boqun@kernel.org \
    --cc=dave@stgolabs.net \
    --cc=frederic@kernel.org \
    --cc=fuwenxin@linux.alibaba.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=neeraj.upadhyay@kernel.org \
    --cc=oliver.yang@linux.alibaba.com \
    --cc=paulmck@kernel.org \
    --cc=qiang.zhang@linux.dev \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=urezki@gmail.com \
    --cc=xlpang@linux.alibaba.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

all inboxes | Powered by JetHome®