Re: [PATCH] x86/bugs: Qualify RETBLEED_INTEL_MSG

From: Josh Poimboeuf

Date: Fri Oct 10 2025 - 16:49:42 EST


On Fri, Oct 10, 2025 at 07:27:22PM +0000, Kaplan, David wrote:
> > On Fri, Oct 10, 2025 at 11:47:25AM -0700, Pawan Gupta wrote:
> > > > 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
> > >
> > > That would be good if a kernel is built for certain specific CPU(s). This
> > > may not be ideal for distro kernels.
> >
> > Why not? A distro can just enable everything:
> >
> > CONFIG_MITIGATION_SPECTRE_V2=y
> > CONFIG_MITIGATION_SPECTRE_V2_RETPOLINE=y
> > CONFIG_MITIGATION_SPECTRE_V2_IBRS=y
> >
> > and then if/when some older HW ages out of being supported by the
> > distro, they can start disabling things.
> >
>
> Is this really improving things?
>
> There's already a lot of CONFIG options related to mitigations that
> make testing a pain, and this seems to just make it worse by now
> having even more options that may or may not make sense together.
>
> I get the value in building a kernel with all mitigations disabled,
> although frankly I think that only makes sense if it's substantially
> better than just 'mitigations=off'. But is the cost of only building
> support for IBRS and not retpoline really buying much?

I think this would add several improvements.

It makes it clearer *why* retpolines are enabled: to mitigate Spectre v2
for older hardware. (Though, frustratingly, retpolines have made a
comeback thanks to ITS.)

If I know I won't be running my kernel on old HW, this would make it
easy to phase out old mitigations that are no longer needed, that
otherwise uglify the code and might affect performance even when they're
disabled at runtime.

That would be useful for me personally (I don't want that crap in my
kernel if I don't need it), but also for distros which phase out support
for older CPUs.

Yes, it does add some config options, but we can counterbalance that by
removing all the ones which set the defaults, and instead only allow
changing defaults at the granularity of attack vectors.

And these MITIGATION config options wouldn't need to be referenced by
actual code. Their purpose would be to select
CONFIG_BUILD_INDIRECT_THUNKS and friends, as needed, which are in a
separate namespace (naming bikeshedding welcome). So overall I think
there would be a lot less confusion about the purpose of each config
option.

(Yes, CONFIG_MITIGATION_* could also be used to compile out individual
mitigations, but I'm not quite convinced that would be worth all the
ifdeffery)

That's kind of a lot, I can work up some patches to clarify what it all
would look like.

--
Josh