From: Herbert Xu <herbert@gondor.apana.org.au>
To: paulmck@kernel.org
Cc: rostedt@goodmis.org, dongml2@chinatelecom.cn,
mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
oliver.sang@intel.com, tgraf@suug.ch,
linux-crypto@vger.kernel.org
Subject: Re: [PATCH] tracing: fprobe: fix suspicious rcu usage in fprobe_entry
Date: Mon, 1 Sep 2025 18:06:05 +0800 [thread overview]
Message-ID: <aLVwDR_NJSAGaHdf@gondor.apana.org.au> (raw)
In-Reply-To: <d1da3939-62e6-4ad1-afcc-5710ce3f6cbd@paulmck-laptop>
Paul E. McKenney <paulmck@kernel.org> wrote:
>
> Yes, preempt_disable() does indeed start an RCU read-side critical section,
> just as surely as rcu_read_lock() does.
>
> However, this is a lockdep check inside of __rhashtable_lookup():
>
> rht_dereference_rcu(ht->tbl, ht)
>
> Which is defined as:
>
> rcu_dereference_check(p, lockdep_rht_mutex_is_held(ht));
>
> This is explicitly telling lockdep that rcu_read_lock() is OK and
> holding ht->mutex is OK, but nothing else is.
I think that's a deficiency in rcu_dereference_check.
Yes I could certainly add a preemption check to rht_dereference_rcu,
but that makes zero sense because this is an implementation detail
of RCU and there is no reason why this logic should be added to
rhashtable.
rhashtable never relies on the fact that turning off preemption
creates is safe for RCU reads, so it makes no sense to add this
logic to rht_dereference_rcu since RCU could conceivably (even
if it is unlikely) be changed on day so that turning off preemption
is no longer safe for RCU reads.
My preference would be to add the preemption test to
rcu_dereference_check, or if that is not possible for some reason,
create a new RCU helper that includes the preemption test.
Of course just adding RCU read locks as this patch does is also
fine.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
next prev parent reply other threads:[~2025-09-01 10:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-29 2:14 Menglong Dong
2025-08-29 2:23 ` Steven Rostedt
2025-08-29 2:49 ` menglong.dong
2025-08-29 11:12 ` Paul E. McKenney
2025-08-29 11:11 ` Paul E. McKenney
2025-09-01 8:06 ` Masami Hiramatsu
2025-09-01 15:00 ` Paul E. McKenney
2025-09-02 6:59 ` Masami Hiramatsu
2025-09-02 11:58 ` Paul E. McKenney
2025-09-03 9:43 ` Herbert Xu
2025-09-04 9:44 ` [PATCH] rhashtable: Use rcu_dereference_all and rcu_dereference_all_check Herbert Xu
2025-09-08 15:23 ` Paul E. McKenney
2025-09-09 9:50 ` [v2 PATCH] " Herbert Xu
2025-09-25 10:17 ` Andrea Righi
2025-09-01 10:06 ` Herbert Xu [this message]
2025-09-01 8:22 ` [PATCH] tracing: fprobe: fix suspicious rcu usage in fprobe_entry Masami Hiramatsu
2025-09-02 9:17 ` Herbert Xu
2025-09-02 9:50 ` menglong.dong
2025-09-03 4:22 ` Herbert Xu
2025-09-04 3:37 ` Menglong Dong
2025-09-04 4:29 ` Masami Hiramatsu
2025-09-04 5:42 ` Menglong Dong
2025-09-04 9:08 ` Herbert Xu
2025-09-02 14:57 ` Steven Rostedt
2025-09-03 4:23 ` Herbert Xu
2025-09-04 5:41 ` menglong.dong
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=aLVwDR_NJSAGaHdf@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=dongml2@chinatelecom.cn \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=oliver.sang@intel.com \
--cc=paulmck@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tgraf@suug.ch \
/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®