Re: [PATCH] x86/bugs: Qualify RETBLEED_INTEL_MSG
From: Josh Poimboeuf
Date: Tue Oct 07 2025 - 20:14:31 EST
On Tue, Oct 07, 2025 at 04:08:21PM -0700, Pawan Gupta wrote:
> On Wed, Oct 08, 2025 at 12:12:29AM +0200, Borislav Petkov wrote:
> > On Tue, Oct 07, 2025 at 11:22:57AM -0700, Pawan Gupta wrote:
> > > IMO, rather than targeting the mitigation enabling code it might make more
> > > sense to compile out the actual mitigations scattered accross the kernel.
> > > This may also improve performance by reducing the code footprint, and can
> > > also help getting a cleaner disassembly.
Isn't that what CONFIG_CPU_MITIGATIONS=n already does today?
> > Probably... however, it needs to be done smartly because sprinkling ifdeffery
> > and turning what is an already unreadable mess into a bigger abomination,
> > won't fly. Perhaps split out the mitigations glue into separate compilation
> > units and build-disable them... we'll see.
>
> Ya, that would be better.
On a sort of related note, it's confusing that there are two completely
different classes of MITIGATION options which get conflated:
1) compile the kernel with support for certain mitigations:
MITIGATION_RETPOLINE
MITIGATION_RETHUNK
MITIGATION_PAGE_TABLE_ISOLATION
MITIGATION_UNRET_ENTRY
MITIGATION_CALL_DEPTH_TRACKING
MITIGATION_IBPB_ENTRY
MITIGATION_IBRS_ENTRY
MITIGATION_SRSO
MITIGATION_SLS
2) enable bug-specific runtime defaults:
MITIGATION_GDS
MITIGATION_RFDS
MITIGATION_SPECTRE_BHI
MITIGATION_MDS
MITIGATION_TAA
MITIGATION_MMIO_STALE_DATA
MITIGATION_L1TF
MITIGATION_RETBLEED
MITIGATION_SPECTRE_V1
MITIGATION_SPECTRE_V2
MITIGATION_SRBDS
MITIGATION_SSB
MITIGATION_ITS
MITIGATION_TSA
MITIGATION_VMSCAPE
In general, #1 uglify the kernel. And some #2 depend on #1.
IMO, we should rename the #1 options. For example:
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 ;-)
--
Josh