Re: [PATCH] cfi: rust: pass -Zpatchable-function-entry on all architectures

From: Sami Tolvanen
Date: Wed Oct 09 2024 - 12:48:48 EST


On Tue, Oct 8, 2024 at 10:37 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> The KCFI sanitizer stores the CFI tag of a function just before its
> machine code. However, the patchable-function-entry flag can be used to
> introduce additional nop instructions before the machine code, taking up
> the space that normally holds the CFI tag. In this case, a backwards
> offset is applied to the CFI tag to move them out of the way of the nop
> instructions. To ensure that C and Rust agree on the offset used by CFI
> tags, pass the -Zpatchable-function-entry to rustc whenever it is passed
> to the C compiler.
>
> The required rustc version is bumped to 1.81.0 to ensure that the
> -Zpatchable-function-entry flag is available when CFI is used.
>
> Fixes: ca627e636551 ("rust: cfi: add support for CFI_CLANG with Rust")
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

Reviewed-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>

Sami