Re: [PATCH] x86/rust: use `-Zindirect-branch-cs-prefix` for RETPOLINE builds

From: Miguel Ojeda

Date: Tue Nov 10 2026 - 15:47:51 EST


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