Skip to content

Commit 8b3641d

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add attack vector controls for SSB
Attack vector controls for SSB were missed in the initial attack vector series. The default mitigation for SSB requires user-space opt-in so it is only relevant for user->user attacks. Check with attack vector controls when the command is auto - i.e., no explicit user selection has been done. Fixes: 2d31d28 ("x86/bugs: Define attack vectors relevant for each bug") Signed-off-by: David Kaplan <david.kaplan@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/20250819192200.2003074-5-david.kaplan@amd.com
1 parent c2415c4 commit 8b3641d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

Documentation/admin-guide/hw-vuln/attack_vector_controls.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Spectre_v2 X X
215215
Spectre_v2_user X X * (Note 1)
216216
SRBDS X X X X
217217
SRSO X X X X
218-
SSB (Note 4)
218+
SSB X
219219
TAA X X X X * (Note 2)
220220
TSA X X X X
221221
=============== ============== ============ ============= ============== ============ ========
@@ -229,9 +229,6 @@ Notes:
229229
3 -- Disables SMT if cross-thread mitigations are fully enabled, the CPU is
230230
vulnerable, and STIBP is not supported
231231

232-
4 -- Speculative store bypass is always enabled by default (no kernel
233-
mitigation applied) unless overridden with spec_store_bypass_disable option
234-
235232
When an attack-vector is disabled, all mitigations for the vulnerabilities
236233
listed in the above table are disabled, unless mitigation is required for a
237234
different enabled attack-vector or a mitigation is explicitly selected via a

arch/x86/kernel/cpu/bugs.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ static bool __init should_mitigate_vuln(unsigned int bug)
416416
cpu_attack_vector_mitigated(CPU_MITIGATE_USER_USER) ||
417417
cpu_attack_vector_mitigated(CPU_MITIGATE_GUEST_GUEST) ||
418418
(smt_mitigations != SMT_MITIGATIONS_OFF);
419+
420+
case X86_BUG_SPEC_STORE_BYPASS:
421+
return cpu_attack_vector_mitigated(CPU_MITIGATE_USER_USER);
422+
419423
default:
420424
WARN(1, "Unknown bug %x\n", bug);
421425
return false;
@@ -2710,6 +2714,11 @@ static void __init ssb_select_mitigation(void)
27102714
ssb_mode = SPEC_STORE_BYPASS_DISABLE;
27112715
break;
27122716
case SPEC_STORE_BYPASS_CMD_AUTO:
2717+
if (should_mitigate_vuln(X86_BUG_SPEC_STORE_BYPASS))
2718+
ssb_mode = SPEC_STORE_BYPASS_PRCTL;
2719+
else
2720+
ssb_mode = SPEC_STORE_BYPASS_NONE;
2721+
break;
27132722
case SPEC_STORE_BYPASS_CMD_PRCTL:
27142723
ssb_mode = SPEC_STORE_BYPASS_PRCTL;
27152724
break;

0 commit comments

Comments
 (0)