Re: [PATCH 2/2] rust: cfi: add support for CFI_CLANG with Rust

From: Peter Zijlstra
Date: Tue Jul 30 2024 - 12:03:37 EST


On Tue, Jul 30, 2024 at 08:24:15AM -0700, Sami Tolvanen wrote:
> On Tue, Jul 30, 2024 at 3:32 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > On Tue, Jul 30, 2024 at 09:40:12AM +0000, Alice Ryhl wrote:
> > > From: Matthew Maurer <mmaurer@xxxxxxxxxx>
> > >
> > > Make it possible to use the Control Flow Integrity (CFI) sanitizer when
> > > Rust is enabled. Enabling CFI with Rust requires that CFI is configured
> > > to normalize integer types so that all integer types of the same size
> > > and signedness are compatible under CFI.
> >
> > I am assuming -- because I have to, because you're not actually saying
> > anyting -- that this is fully compatible with the C version and all the
> > fun and games we play with rewriting the function prologue for FineIBT
> > and the like also work?
>
> Rust uses the same LLVM backend for the actual code generation, so it
> should be fully compatible.

Yes, but we also combine that with -fpatchable-function-entry= for a
very specific effect, and I don't think I see the Rust thingy do that.