Re: C aggregate passing (Rust kernel policy)

From: Miguel Ojeda
Date: Tue Feb 25 2025 - 17:43:32 EST


On Tue, Feb 25, 2025 at 8:48 PM Kent Overstreet
<kent.overstreet@xxxxxxxxx> wrote:
>
> I think the one thing that's missing w.r.t. aliasing that Rust could
> maybe use is a kasan-style sanitizer, I think with treeborrows and "now
> we have an actual model for aliasing optimizations" it should be possible
> to write such a sanitizer. But the amount of code doing complicated
> enough stuff with unsafe should really be quite small, so - shouldn't be

Miri implements those models and can check code for conformance. It
can be used easily in the Rust playground (top-right corner -> Tools
-> Miri):

https://play.rust-lang.org

However, it does not work when you involved C FFI, though, but you can
play there. For more advanced usage, e.g. testing a particular model
like Tree Borrows, I think you need to use it locally, since I am not
sure if flags can be passed yet.

I would like to get it, plus other tools, into Compiler Explorer, see
e.g. https://github.com/compiler-explorer/compiler-explorer/issues/2563.

Cheers,
Miguel