Re: C aggregate passing (Rust kernel policy)

Steven Rostedt
2025-02-26T21:26:16Z

On Wed, 26 Feb 2025 13:14:30 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> Similarly, if the source code has a single read, the compiler had
> better not turn that into two reads (because of some register pressure
> issue). That would *ALSO* be a bug, because of the whole TOCTOU issue
> (ie the source code may have had one single access, done sanity
> testing on the value before using it, and if the compiler turned it
> all into "read+sanity test" and "read+use", the compiler is
> introducing behavioral differences).

As a bystander here, I just want to ask, do you mean basically to treat all
reads as READ_ONCE() and all writes as WRITE_ONCE()?

-- Steve