Skip to content

Commit e3a88d4

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add attack vector controls for MDS
Use attack vector controls to determine if MDS mitigation is required. The global mitigations=off command now simply disables all attack vectors so explicit checking of mitigations=off is no longer needed. If cross-thread attack mitigations are required, disable SMT. Signed-off-by: David Kaplan <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent 2d31d28 commit e3a88d4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,17 @@ static bool verw_clear_cpu_buf_mitigation_selected __ro_after_init;
441441

442442
static void __init mds_select_mitigation(void)
443443
{
444-
if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) {
444+
if (!boot_cpu_has_bug(X86_BUG_MDS)) {
445445
mds_mitigation = MDS_MITIGATION_OFF;
446446
return;
447447
}
448448

449-
if (mds_mitigation == MDS_MITIGATION_AUTO)
450-
mds_mitigation = MDS_MITIGATION_FULL;
449+
if (mds_mitigation == MDS_MITIGATION_AUTO) {
450+
if (should_mitigate_vuln(X86_BUG_MDS))
451+
mds_mitigation = MDS_MITIGATION_FULL;
452+
else
453+
mds_mitigation = MDS_MITIGATION_OFF;
454+
}
451455

452456
if (mds_mitigation == MDS_MITIGATION_OFF)
453457
return;
@@ -457,7 +461,7 @@ static void __init mds_select_mitigation(void)
457461

458462
static void __init mds_update_mitigation(void)
459463
{
460-
if (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off())
464+
if (!boot_cpu_has_bug(X86_BUG_MDS))
461465
return;
462466

463467
/* If TAA, MMIO, or RFDS are being mitigated, MDS gets mitigated too. */
@@ -478,7 +482,7 @@ static void __init mds_apply_mitigation(void)
478482
mds_mitigation == MDS_MITIGATION_VMWERV) {
479483
setup_force_cpu_cap(X86_FEATURE_CLEAR_CPU_BUF);
480484
if (!boot_cpu_has(X86_BUG_MSBDS_ONLY) &&
481-
(mds_nosmt || cpu_mitigations_auto_nosmt()))
485+
(mds_nosmt || smt_mitigations == SMT_MITIGATIONS_ON))
482486
cpu_smt_disable(false);
483487
}
484488
}

0 commit comments

Comments
 (0)