Re: [PATCH v2] x86/speculation: Simplify and make CALL_NOSPEC consistent
From: Pawan Gupta
Date: Fri Feb 28 2025 - 11:49:03 EST
On Fri, Feb 28, 2025 at 10:36:43AM +0100, Ingo Molnar wrote:
>
> * Pawan Gupta <pawan.kumar.gupta@xxxxxxxxxxxxxxx> wrote:
>
> > CALL_NOSPEC macro is used to generate Spectre-v2 mitigation friendly
> > indirect branches. At compile time the macro defaults to indirect branch,
> > and at runtime those can be patched to thunk based mitigations.
> >
> > This approach is opposite of what is done for the rest of the kernel, where
> > the compile time default is to replace indirect calls with retpoline thunk
> > calls.
> >
> > Make CALL_NOSPEC consistent with the rest of the kernel, default to
> > retpoline thunk at compile time when CONFIG_MITIGATION_RETPOLINE is
> > enabled.
> >
> > Also add the missing __CS_PREFIX to the CALL_NOSPEC macro to make it
> > compatible with -mindirect-branch-cs-prefix.
>
> The __CS_PREFIX change should probably be a separate patch.
Yes, I will split it into a separate patch.