Re: C aggregate passing (Rust kernel policy)

Ventura Jack
2025-03-06T19:16:15Z

On Wed, Feb 26, 2025 at 4:17 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Wed, 26 Feb 2025 at 14:27, Kent Overstreet <kent.overstreet@linux.dev> wrote:
> >
> > This is another one that's entirely eliminated due to W^X references.
>
> Are you saying rust cannot have global flags?
>
> That seems unlikely. And broken if so.
>
> > IOW: if you're writing code where rematerializing reads is even a
> > _concern_ in Rust, then you had to drop to unsafe {} to do it - and your
> > code is broken, and yes it will have UB.
>
> If you need to drop to unsafe mode just to read a global flag that may
> be set concurrently, you're doing something wrong as a language
> designer.
>
> And if your language then rematerializes reads, the language is shit.
>
> Really.
>
> Linus

Rust does allow global mutable flags, but some kinds of
them are very heavily discouraged, even in unsafe Rust.

https://doc.rust-lang.org/edition-guide/rust-2024/static-mut-references.html

Best, VJ.