Skip to content

Commit 2f970a5

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add attack vector controls for L1TF
Use attack vector controls to determine if L1TF mitigation is required. Disable SMT if cross-thread protection is desired. Signed-off-by: David Kaplan <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent fdf9922 commit 2f970a5

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2995,17 +2995,23 @@ static void override_cache_bits(struct cpuinfo_x86 *c)
29952995

29962996
static void __init l1tf_select_mitigation(void)
29972997
{
2998-
if (!boot_cpu_has_bug(X86_BUG_L1TF) || cpu_mitigations_off()) {
2998+
if (!boot_cpu_has_bug(X86_BUG_L1TF)) {
29992999
l1tf_mitigation = L1TF_MITIGATION_OFF;
30003000
return;
30013001
}
30023002

3003-
if (l1tf_mitigation == L1TF_MITIGATION_AUTO) {
3004-
if (cpu_mitigations_auto_nosmt())
3005-
l1tf_mitigation = L1TF_MITIGATION_FLUSH_NOSMT;
3006-
else
3007-
l1tf_mitigation = L1TF_MITIGATION_FLUSH;
3003+
if (l1tf_mitigation != L1TF_MITIGATION_AUTO)
3004+
return;
3005+
3006+
if (!should_mitigate_vuln(X86_BUG_L1TF)) {
3007+
l1tf_mitigation = L1TF_MITIGATION_OFF;
3008+
return;
30083009
}
3010+
3011+
if (smt_mitigations == SMT_MITIGATIONS_ON)
3012+
l1tf_mitigation = L1TF_MITIGATION_FLUSH_NOSMT;
3013+
else
3014+
l1tf_mitigation = L1TF_MITIGATION_FLUSH;
30093015
}
30103016

30113017
static void __init l1tf_apply_mitigation(void)

0 commit comments

Comments
 (0)