Skip to content

Commit 0cdd2c4

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add attack vector controls for ITS
Use attack vector controls to determine if ITS 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 eda718f commit 0cdd2c4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,13 +1518,17 @@ early_param("indirect_target_selection", its_parse_cmdline);
15181518

15191519
static void __init its_select_mitigation(void)
15201520
{
1521-
if (!boot_cpu_has_bug(X86_BUG_ITS) || cpu_mitigations_off()) {
1521+
if (!boot_cpu_has_bug(X86_BUG_ITS)) {
15221522
its_mitigation = ITS_MITIGATION_OFF;
15231523
return;
15241524
}
15251525

1526-
if (its_mitigation == ITS_MITIGATION_AUTO)
1527-
its_mitigation = ITS_MITIGATION_ALIGNED_THUNKS;
1526+
if (its_mitigation == ITS_MITIGATION_AUTO) {
1527+
if (should_mitigate_vuln(X86_BUG_ITS))
1528+
its_mitigation = ITS_MITIGATION_ALIGNED_THUNKS;
1529+
else
1530+
its_mitigation = ITS_MITIGATION_OFF;
1531+
}
15281532

15291533
if (its_mitigation == ITS_MITIGATION_OFF)
15301534
return;
@@ -1555,12 +1559,13 @@ static void __init its_select_mitigation(void)
15551559

15561560
static void __init its_update_mitigation(void)
15571561
{
1558-
if (!boot_cpu_has_bug(X86_BUG_ITS) || cpu_mitigations_off())
1562+
if (!boot_cpu_has_bug(X86_BUG_ITS))
15591563
return;
15601564

15611565
switch (spectre_v2_enabled) {
15621566
case SPECTRE_V2_NONE:
1563-
pr_err("WARNING: Spectre-v2 mitigation is off, disabling ITS\n");
1567+
if (its_mitigation != ITS_MITIGATION_OFF)
1568+
pr_err("WARNING: Spectre-v2 mitigation is off, disabling ITS\n");
15641569
its_mitigation = ITS_MITIGATION_OFF;
15651570
break;
15661571
case SPECTRE_V2_RETPOLINE:

0 commit comments

Comments
 (0)