Skip to content

Commit de6f092

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add attack vector controls for MMIO
Use attack vectors controls to determine if MMIO mitigation is required. Signed-off-by: David Kaplan <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent 736565d commit de6f092

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,12 @@ static void __init mmio_select_mitigation(void)
639639
}
640640

641641
/* Microcode will be checked in mmio_update_mitigation(). */
642-
if (mmio_mitigation == MMIO_MITIGATION_AUTO)
643-
mmio_mitigation = MMIO_MITIGATION_VERW;
642+
if (mmio_mitigation == MMIO_MITIGATION_AUTO) {
643+
if (should_mitigate_vuln(X86_BUG_MMIO_STALE_DATA))
644+
mmio_mitigation = MMIO_MITIGATION_VERW;
645+
else
646+
mmio_mitigation = MMIO_MITIGATION_OFF;
647+
}
644648

645649
if (mmio_mitigation == MMIO_MITIGATION_OFF)
646650
return;
@@ -655,7 +659,7 @@ static void __init mmio_select_mitigation(void)
655659

656660
static void __init mmio_update_mitigation(void)
657661
{
658-
if (!boot_cpu_has_bug(X86_BUG_MMIO_STALE_DATA) || cpu_mitigations_off())
662+
if (!boot_cpu_has_bug(X86_BUG_MMIO_STALE_DATA))
659663
return;
660664

661665
if (verw_clear_cpu_buf_mitigation_selected)
@@ -703,7 +707,7 @@ static void __init mmio_apply_mitigation(void)
703707
if (!(x86_arch_cap_msr & ARCH_CAP_FBSDP_NO))
704708
static_branch_enable(&cpu_buf_idle_clear);
705709

706-
if (mmio_nosmt || cpu_mitigations_auto_nosmt())
710+
if (mmio_nosmt || smt_mitigations == SMT_MITIGATIONS_ON)
707711
cpu_smt_disable(false);
708712
}
709713

0 commit comments

Comments
 (0)