Re: [PATCH] x86/bugs: Qualify RETBLEED_INTEL_MSG
From: Josh Poimboeuf
Date: Thu Oct 09 2025 - 21:10:52 EST
On Wed, Oct 08, 2025 at 10:33:36PM -0700, Pawan Gupta wrote:
> On Tue, Oct 07, 2025 at 05:14:29PM -0700, Josh Poimboeuf wrote:
> > On Tue, Oct 07, 2025 at 04:08:21PM -0700, Pawan Gupta wrote:
> > MITIGATION_RETPOLINE -> X86_UGLY_INDIRECT_THUNKS
> > MITIGATION_RETHUNK -> X86_UGLY_RETURN_THUNKS
> >
> > etc...
> >
> > Then one only needs to grep their .config file for UGLY to understand
> > why their disassembly is so inscrutable ;-)
>
> :-) Agree, this is ugly. One way to handle this could be two levels of
> Kconfig options like below:
>
> * CONFIG_MITIGATION_FOO - Compiles out the mitigation
Maybe, though compiling out individual features would be complicated by
the fact that we have dependencies between several of the mitigations,
as evidenced by *_update_mitigation().
> * CONFIG_MITIGATION_FOO_DEFAULT - Sets the bootup default
I'm wondering if we can just get rid of the compiled-in defaults. Do
people really need that anymore, now that we have the attack vector
controls? We could instead have
CONFIG_CPU_MITIGATIONS_OFF
CONFIG_CPU_MITIGATIONS_AUTO
CONFIG_CPU_MITIGATIONS_AUTO_NOSMT
CONFIG_CPU_MITIGATIONS_USER_USER
CONFIG_CPU_MITIGATIONS_USER_KERNEL
CONFIG_CPU_MITIGATIONS_GUEST_HOST
CONFIG_CPU_MITIGATIONS_GUEST_GUEST
... which should cover the main cases. And of course there's always
CONFIG_CMDLINE for more customization.
> select X86_UGLY_INDIRECT_THUNKS
Unfortunately it's not always straightforward enough to say "mitigation
FOO always needs X ugly feature".
For example, newer CPUs mitigate Spectre v2 with enhanced IBRS, so they
don't necessarily need all the retpoline and legacy IBRS stuff. So
CONFIG_MITIGATION_SPECTRE_V2 shouldn't enable those unconditionally.
Instead, CONFIG_MITIGATION_SPECTRE_V2 could enable a submenu which then
allows the user to enable retpoline, IBRS on entry, etc, with each
having help text describing what generations of CPUs it would be the
default for, to help guide the user to choose sane defaults depending on
their CPU:
* CONFIG_MITIGATION_SPECTRE_V2
* CONFIG_MITIGATION_SPECTRE_V2_RETPOLINE
select CONFIG_BUILD_INDIRECT_THUNKS
* CONFIG_MITIGATION_SPECTRE_V2_IBRS
select CONFIG_BUILD_IBRS_ENTRY
--
Josh