There is no way to disable TAA mitigation today at compilation time. TAA
is enabled even if CONFIG_SPECULATION_MITIGATIONS is unset.
Create a new KCONFIG option that allow TAA mitigation to be disabled in
compilation time.
Signed-off-by: Breno Leitao <[email protected]>
---
arch/x86/Kconfig | 10 ++++++++++
arch/x86/kernel/cpu/bugs.c | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d25132b2d54f..140af3b30c45 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2660,6 +2660,16 @@ config MITIGATE_MDS
technical information is available in the MDS specific x86 architecture
section: Documentation/arch/x86/mds.rst.
+config MITIGATE_TAA
+ bool "Mitigate TSX Asynchronous Abort (TAA) hardware bug"
+ depends on CPU_SUP_INTEL && X86_64
+ default y
+ help
+ Enable mitigation for TSX Asynchronous Abort (TAA). TAA is a hardware
+ vulnerability that allows unprivileged speculative access to data
+ which is available in various CPU internal buffers by using
+ asynchronous aborts within an Intel TSX transactional region.
+
endif
config ARCH_HAS_ADD_PAGES
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 50f12829dce9..3615bda9573f 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -336,6 +336,7 @@ enum taa_mitigations {
/* Default mitigation for TAA-affected CPUs */
static enum taa_mitigations taa_mitigation __ro_after_init = TAA_MITIGATION_VERW;
static bool taa_nosmt __ro_after_init;
+#define TAA_WARN_MSG "WARNING: TSX Asynchronous Abort (TAA) speculative mitigation disabled!\n"
static const char * const taa_strings[] = {
[TAA_MITIGATION_OFF] = "Vulnerable",
@@ -359,8 +360,9 @@ static void __init taa_select_mitigation(void)
return;
}
- if (cpu_mitigations_off()) {
+ if (cpu_mitigations_off() || !IS_ENABLED(CONFIG_MITIGATE_TAA)) {
taa_mitigation = TAA_MITIGATION_OFF;
+ pr_err(TAA_WARN_MSG);
return;
}
--
2.34.1