aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Kaplan <[email protected]>2025-07-07 18:33:06 +0000
committerBorislav Petkov (AMD) <[email protected]>2025-07-11 15:56:41 +0000
commit19a5f3ea4394bf813a03d1ff0efe59a7f74cc12c (patch)
treef9103f84f96a40747d114e7799ee5b09e458ef33
parentx86/bugs: Add attack vector controls for GDS (diff)
downloadkernel-19a5f3ea4394bf813a03d1ff0efe59a7f74cc12c.tar.gz
kernel-19a5f3ea4394bf813a03d1ff0efe59a7f74cc12c.zip
x86/bugs: Add attack vector controls for spectre_v1
Use attack vector controls to determine if spectre_v1 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]
-rw-r--r--arch/x86/kernel/cpu/bugs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index e9227e4a9773..130db820d49d 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1144,13 +1144,16 @@ static bool smap_works_speculatively(void)
static void __init spectre_v1_select_mitigation(void)
{
- if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1) || cpu_mitigations_off())
+ if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1))
+ spectre_v1_mitigation = SPECTRE_V1_MITIGATION_NONE;
+
+ if (!should_mitigate_vuln(X86_BUG_SPECTRE_V1))
spectre_v1_mitigation = SPECTRE_V1_MITIGATION_NONE;
}
static void __init spectre_v1_apply_mitigation(void)
{
- if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1) || cpu_mitigations_off())
+ if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1))
return;
if (spectre_v1_mitigation == SPECTRE_V1_MITIGATION_AUTO) {