Skip to content

Commit c5f1e32

Browse files
committed
Merge tag 'x86-urgent-2022-08-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fix from Ingo Molnar: "Fix the 'IBPB mitigated RETBleed' mode of operation on AMD CPUs (not turned on by default), which also need STIBP enabled (if available) to be '100% safe' on even the shortest speculation windows" * tag 'x86-urgent-2022-08-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/bugs: Enable STIBP for IBPB mitigated RETBleed
2 parents 0473436 + e6cfcdd commit c5f1e32

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5274,20 +5274,33 @@
52745274
Speculative Code Execution with Return Instructions)
52755275
vulnerability.
52765276

5277+
AMD-based UNRET and IBPB mitigations alone do not stop
5278+
sibling threads from influencing the predictions of other
5279+
sibling threads. For that reason, STIBP is used on pro-
5280+
cessors that support it, and mitigate SMT on processors
5281+
that don't.
5282+
52775283
off - no mitigation
52785284
auto - automatically select a migitation
52795285
auto,nosmt - automatically select a mitigation,
52805286
disabling SMT if necessary for
52815287
the full mitigation (only on Zen1
52825288
and older without STIBP).
5283-
ibpb - mitigate short speculation windows on
5284-
basic block boundaries too. Safe, highest
5285-
perf impact.
5286-
unret - force enable untrained return thunks,
5287-
only effective on AMD f15h-f17h
5288-
based systems.
5289-
unret,nosmt - like unret, will disable SMT when STIBP
5290-
is not available.
5289+
ibpb - On AMD, mitigate short speculation
5290+
windows on basic block boundaries too.
5291+
Safe, highest perf impact. It also
5292+
enables STIBP if present. Not suitable
5293+
on Intel.
5294+
ibpb,nosmt - Like "ibpb" above but will disable SMT
5295+
when STIBP is not available. This is
5296+
the alternative for systems which do not
5297+
have STIBP.
5298+
unret - Force enable untrained return thunks,
5299+
only effective on AMD f15h-f17h based
5300+
systems.
5301+
unret,nosmt - Like unret, but will disable SMT when STIBP
5302+
is not available. This is the alternative for
5303+
systems which do not have STIBP.
52915304

52925305
Selecting 'auto' will choose a mitigation method at run
52935306
time according to the CPU.

arch/x86/kernel/cpu/bugs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void __init check_bugs(void)
152152
/*
153153
* spectre_v2_user_select_mitigation() relies on the state set by
154154
* retbleed_select_mitigation(); specifically the STIBP selection is
155-
* forced for UNRET.
155+
* forced for UNRET or IBPB.
156156
*/
157157
spectre_v2_user_select_mitigation();
158158
ssb_select_mitigation();
@@ -1179,7 +1179,8 @@ spectre_v2_user_select_mitigation(void)
11791179
boot_cpu_has(X86_FEATURE_AMD_STIBP_ALWAYS_ON))
11801180
mode = SPECTRE_V2_USER_STRICT_PREFERRED;
11811181

1182-
if (retbleed_mitigation == RETBLEED_MITIGATION_UNRET) {
1182+
if (retbleed_mitigation == RETBLEED_MITIGATION_UNRET ||
1183+
retbleed_mitigation == RETBLEED_MITIGATION_IBPB) {
11831184
if (mode != SPECTRE_V2_USER_STRICT &&
11841185
mode != SPECTRE_V2_USER_STRICT_PREFERRED)
11851186
pr_info("Selecting STIBP always-on mode to complement retbleed mitigation\n");
@@ -2360,10 +2361,11 @@ static ssize_t srbds_show_state(char *buf)
23602361

23612362
static ssize_t retbleed_show_state(char *buf)
23622363
{
2363-
if (retbleed_mitigation == RETBLEED_MITIGATION_UNRET) {
2364+
if (retbleed_mitigation == RETBLEED_MITIGATION_UNRET ||
2365+
retbleed_mitigation == RETBLEED_MITIGATION_IBPB) {
23642366
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
23652367
boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
2366-
return sprintf(buf, "Vulnerable: untrained return thunk on non-Zen uarch\n");
2368+
return sprintf(buf, "Vulnerable: untrained return thunk / IBPB on non-AMD based uarch\n");
23672369

23682370
return sprintf(buf, "%s; SMT %s\n",
23692371
retbleed_strings[retbleed_mitigation],

0 commit comments

Comments
 (0)