Re: [PATCH v3 3/6] x86/rust: support MITIGATION_RETHUNK

From: Thomas Gleixner
Date: Fri Aug 09 2024 - 16:03:24 EST


On Thu, Jul 25 2024 at 20:33, Miguel Ojeda wrote:
> The Rust compiler added support for `-Zfunction-return=thunk-extern` [1]
> in 1.76.0 [2], i.e. the equivalent of `-mfunction-return=thunk-extern`.
> Thus add support for `MITIGATION_RETHUNK`.
>
> Without this, `objtool` would warn if enabled for Rust and already warns
> under IBT builds, e.g.:
>
> samples/rust/rust_print.o: warning: objtool:
> _R...init+0xa5c: 'naked' return found in RETHUNK build
>
> Link: https://github.com/rust-lang/rust/issues/116853 [1]
> Link: https://github.com/rust-lang/rust/pull/116892 [2]
> Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>
> Tested-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> Tested-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>

Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>