Skip to content

Commit 736565d

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add attack vector controls for TAA
Use attack vector controls to determine if TAA 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 e3a88d4 commit 736565d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -538,20 +538,21 @@ static void __init taa_select_mitigation(void)
538538
return;
539539
}
540540

541-
if (cpu_mitigations_off())
542-
taa_mitigation = TAA_MITIGATION_OFF;
543-
544541
/* Microcode will be checked in taa_update_mitigation(). */
545-
if (taa_mitigation == TAA_MITIGATION_AUTO)
546-
taa_mitigation = TAA_MITIGATION_VERW;
542+
if (taa_mitigation == TAA_MITIGATION_AUTO) {
543+
if (should_mitigate_vuln(X86_BUG_TAA))
544+
taa_mitigation = TAA_MITIGATION_VERW;
545+
else
546+
taa_mitigation = TAA_MITIGATION_OFF;
547+
}
547548

548549
if (taa_mitigation != TAA_MITIGATION_OFF)
549550
verw_clear_cpu_buf_mitigation_selected = true;
550551
}
551552

552553
static void __init taa_update_mitigation(void)
553554
{
554-
if (!taa_vulnerable() || cpu_mitigations_off())
555+
if (!taa_vulnerable())
555556
return;
556557

557558
if (verw_clear_cpu_buf_mitigation_selected)
@@ -592,7 +593,7 @@ static void __init taa_apply_mitigation(void)
592593
*/
593594
setup_force_cpu_cap(X86_FEATURE_CLEAR_CPU_BUF);
594595

595-
if (taa_nosmt || cpu_mitigations_auto_nosmt())
596+
if (taa_nosmt || smt_mitigations == SMT_MITIGATIONS_ON)
596597
cpu_smt_disable(false);
597598
}
598599
}

0 commit comments

Comments
 (0)