Thread (32 messages) flat view 32 messages, 7 authors, 2021-10-12

Re: [RFC][PATCH] rcu: Use typeof(p) instead of typeof(*p) *

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2021-10-05 16:40:24
Also in: lkml, netfilter-devel, rcu

On Tue, 5 Oct 2021 12:15:04 -0400 (EDT)
Mathieu Desnoyers [off-list ref] wrote:

See Documentation/RCU/arrayRCU.rst:

"It might be tempting to consider use
of RCU to instead protect the index into an array, however, this use
Ah, array indexes. Now that makes sense.
case is **not** supported.  The problem with RCU-protected indexes into
arrays is that compilers can play way too many optimization games with
integers, which means that the rules governing handling of these indexes
are far more trouble than they are worth.  If RCU-protected indexes into
arrays prove to be particularly valuable (which they have not thus far),
explicit cooperation from the compiler will be required to permit them
to be safely used."

So AFAIU validation that rcu_dereference receives a pointer as parameter
is done on purpose.
Thanks for looking at this. I'll go punt and just expose the structure.
It's not a big deal, but I like abstraction of structures when they can be,
just to keep from the temptation of tweaking them directly, and causing
updates later to be more difficult.

Too bad that the failure here is not RCU or the macros, but what I would
call a bug in a specific compiler.

-- Steve
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help