[PATCH v3 35/35] x86/pti: Add attack vector controls for pti
From: David Kaplan
Date: Wed Jan 08 2025 - 15:32:33 EST
Disable PTI mitigation if user->kernel attack vector mitigations are
disabled.
Signed-off-by: David Kaplan <david.kaplan@xxxxxxx>
---
arch/x86/mm/pti.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c
index 5f0d579932c6..132840528d55 100644
--- a/arch/x86/mm/pti.c
+++ b/arch/x86/mm/pti.c
@@ -38,6 +38,7 @@
#include <asm/desc.h>
#include <asm/sections.h>
#include <asm/set_memory.h>
+#include <asm/bugs.h>
#undef pr_fmt
#define pr_fmt(fmt) "Kernel/User page tables isolation: " fmt
@@ -94,7 +95,8 @@ void __init pti_check_boottime_disable(void)
if (pti_mode == PTI_FORCE_ON)
pti_print_if_secure("force enabled on command line.");
- if (pti_mode == PTI_AUTO && !boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN))
+ if (pti_mode == PTI_AUTO && (!boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN) ||
+ !cpu_mitigate_attack_vector(CPU_MITIGATE_USER_KERNEL)))
return;
setup_force_cpu_cap(X86_FEATURE_PTI);
--
2.34.1