Skip to content

Commit 3a4ee4f

Browse files
leitaobp3tk0v
authored andcommitted
x86/bugs: Add a separate config for L1TF
Currently, the CONFIG_SPECULATION_MITIGATIONS is halfway populated, where some mitigations have entries in Kconfig, and they could be modified, while others mitigations do not have Kconfig entries, and could not be controlled at build time. Create an entry for the L1TF CPU mitigation under CONFIG_SPECULATION_MITIGATIONS. This allow users to enable or disable it at compilation time. Signed-off-by: Breno Leitao <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 163f9fe commit 3a4ee4f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

arch/x86/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,16 @@ config MITIGATION_MMIO_STALE_DATA
26822682
attacker to have access to MMIO.
26832683
See also
26842684
<file:Documentation/admin-guide/hw-vuln/processor_mmio_stale_data.rst>
2685+
2686+
config MITIGATION_L1TF
2687+
bool "Mitigate L1 Terminal Fault (L1TF) hardware bug"
2688+
depends on CPU_SUP_INTEL
2689+
default y
2690+
help
2691+
Mitigate L1 Terminal Fault (L1TF) hardware bug. L1 Terminal Fault is a
2692+
hardware vulnerability which allows unprivileged speculative access to data
2693+
available in the Level 1 Data Cache.
2694+
See <file:Documentation/admin-guide/hw-vuln/l1tf.rst
26852695
endif
26862696

26872697
config ARCH_HAS_ADD_PAGES

arch/x86/kernel/cpu/bugs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2374,7 +2374,8 @@ EXPORT_SYMBOL_GPL(itlb_multihit_kvm_mitigation);
23742374
#define pr_fmt(fmt) "L1TF: " fmt
23752375

23762376
/* Default mitigation for L1TF-affected CPUs */
2377-
enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH;
2377+
enum l1tf_mitigations l1tf_mitigation __ro_after_init =
2378+
IS_ENABLED(CONFIG_MITIGATION_L1TF) ? L1TF_MITIGATION_FLUSH : L1TF_MITIGATION_OFF;
23782379
#if IS_ENABLED(CONFIG_KVM_INTEL)
23792380
EXPORT_SYMBOL_GPL(l1tf_mitigation);
23802381
#endif

0 commit comments

Comments
 (0)