Re: [PATCH] x86/rust: use `-Zindirect-branch-cs-prefix` for RETPOLINE builds
From: Borislav Petkov
Date: Tue Nov 10 2026 - 16:54:22 EST
On November 10, 2026 8:31:08 PM UTC, Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>On Sun, Oct 18, 2026 at 7:55 PM Miguel Ojeda <ojeda@xxxxxxxxxx> wrote:
>>
>> The C compiler is asked to add a `cs` prefix to the `call` and `jmp`
>> instructions that go through the indirect thunks for the `r8`-`r15`
>> registers, which makes them 6 bytes long instead of 5. That gives
>> `patch_retpoline()` enough room to inline them, e.g. as `lfence; call
>> *%r11` for `spectre_v2=retpoline,lfence`.
>>
>> However, Rust code does not get the prefix, e.g. for a
>> `CONFIG_MITIGATION_RETPOLINE=y` build:
>
>Any comments on this?
>
>If it helps, then I am happy to take it via one of the Rust trees with
>an Acked-by from x86.
>
>Thanks!
>
>Cheers,
>Miguel
LGTM.
Acked-by: Borislav Petkov <bp@xxxxxxxxx>
--
Small device. Typos and formatting crap