Re: C aggregate passing (Rust kernel policy)

From: Steven Rostedt
Date: Wed Feb 26 2025 - 16:26:25 EST


On Wed, 26 Feb 2025 13:14:30 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> 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