Skip to content

Commit 19a5f3e

Browse files
dkaplan2bp3tk0v
authored andcommitted
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]
1 parent 8c7261a commit 19a5f3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,13 +1144,16 @@ static bool smap_works_speculatively(void)
11441144

11451145
static void __init spectre_v1_select_mitigation(void)
11461146
{
1147-
if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1) || cpu_mitigations_off())
1147+
if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1))
1148+
spectre_v1_mitigation = SPECTRE_V1_MITIGATION_NONE;
1149+
1150+
if (!should_mitigate_vuln(X86_BUG_SPECTRE_V1))
11481151
spectre_v1_mitigation = SPECTRE_V1_MITIGATION_NONE;
11491152
}
11501153

11511154
static void __init spectre_v1_apply_mitigation(void)
11521155
{
1153-
if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1) || cpu_mitigations_off())
1156+
if (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1))
11541157
return;
11551158

11561159
if (spectre_v1_mitigation == SPECTRE_V1_MITIGATION_AUTO) {

0 commit comments

Comments
 (0)