From: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>,
"Kaplan, David" <David.Kaplan@amd.com>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"H . Peter Anvin" <hpa@zytor.com>,
Klaus Kusche <klaus.kusche@computerix.info>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/bugs: Qualify RETBLEED_INTEL_MSG
Date: Wed, 8 Oct 2025 22:33:36 -0700 [thread overview]
Message-ID: <20251009053336.ghcmhgsprtkgydas@desk> (raw)
In-Reply-To: <sb7p6quwxkn4w4etgsxlqd6fcsia4xobf73d3fnybxafxrmvwi@ajg5lkdxtnfy>
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:
> > 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?
Not entirely, looking at entry_64.o for example, I see 243 NOPs with
CONFIG_CPU_MITIGATIONS=n. I suspect a lot of them are due to ALTERNATIVEs
for mitigations. In the same file, clear_bhb_loop() is not compliled out
and adds ~160 bytes.
Another example is process.c which still contains below functions:
0000000000000000 <speculation_ctrl_update_tif>:
00000000000008b0 <speculative_store_bypass_ht_init>:
0000000000000980 <speculation_ctrl_update>:
0000000000000c30 <speculation_ctrl_update_current>:
> > > 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 ;-)
:-) 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
* CONFIG_MITIGATION_FOO_DEFAULT - Sets the bootup default
select X86_UGLY_INDIRECT_THUNKS
Then supporting mitigation like INDIRECT_THUNKS would only be enabled if
there is a dependent mitigation enabled.
next prev parent reply other threads:[~2025-10-09 5:33 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 17:19 David Kaplan
2025-10-06 13:11 ` Borislav Petkov
2025-10-06 13:58 ` Kaplan, David
2025-10-06 14:04 ` Borislav Petkov
2025-10-07 18:22 ` Pawan Gupta
2025-10-07 22:12 ` Borislav Petkov
2025-10-07 23:08 ` Pawan Gupta
2025-10-08 0:14 ` Josh Poimboeuf
2025-10-08 10:21 ` Borislav Petkov
2025-10-09 1:07 ` Josh Poimboeuf
2025-10-09 10:19 ` Borislav Petkov
2025-10-09 6:04 ` Pawan Gupta
2025-10-09 10:15 ` Borislav Petkov
2025-10-09 17:13 ` Pawan Gupta
2025-10-09 18:13 ` Kaplan, David
2025-10-09 23:14 ` Borislav Petkov
2025-10-14 10:50 ` David Laight
2025-11-02 20:11 ` Borislav Petkov
2025-10-09 5:33 ` Pawan Gupta [this message]
2025-10-10 1:10 ` Josh Poimboeuf
2025-10-10 18:47 ` Pawan Gupta
2025-10-10 19:19 ` Josh Poimboeuf
2025-10-10 19:24 ` Pawan Gupta
2025-10-10 19:27 ` Kaplan, David
2025-10-10 20:47 ` Josh Poimboeuf
2025-10-10 21:13 ` Kaplan, David
2025-10-11 1:20 ` Josh Poimboeuf
2025-10-21 10:35 ` [tip: x86/urgent] " tip-bot2 for David Kaplan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251009053336.ghcmhgsprtkgydas@desk \
--to=pawan.kumar.gupta@linux.intel.com \
--cc=David.Kaplan@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@kernel.org \
--cc=klaus.kusche@computerix.info \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®