Skip to content

Commit 9687eb2

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Add attack vector controls for retbleed
Use attack vector controls to determine if retbleed mitigation is required. Disable SMT if cross-thread protection is desired and STIBP is not available. Signed-off-by: David Kaplan <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent 19a5f3e commit 9687eb2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ early_param("retbleed", retbleed_parse_cmdline);
13131313

13141314
static void __init retbleed_select_mitigation(void)
13151315
{
1316-
if (!boot_cpu_has_bug(X86_BUG_RETBLEED) || cpu_mitigations_off()) {
1316+
if (!boot_cpu_has_bug(X86_BUG_RETBLEED)) {
13171317
retbleed_mitigation = RETBLEED_MITIGATION_NONE;
13181318
return;
13191319
}
@@ -1350,6 +1350,11 @@ static void __init retbleed_select_mitigation(void)
13501350
if (retbleed_mitigation != RETBLEED_MITIGATION_AUTO)
13511351
return;
13521352

1353+
if (!should_mitigate_vuln(X86_BUG_RETBLEED)) {
1354+
retbleed_mitigation = RETBLEED_MITIGATION_NONE;
1355+
return;
1356+
}
1357+
13531358
/* Intel mitigation selected in retbleed_update_mitigation() */
13541359
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
13551360
boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) {
@@ -1373,7 +1378,7 @@ static void __init retbleed_select_mitigation(void)
13731378

13741379
static void __init retbleed_update_mitigation(void)
13751380
{
1376-
if (!boot_cpu_has_bug(X86_BUG_RETBLEED) || cpu_mitigations_off())
1381+
if (!boot_cpu_has_bug(X86_BUG_RETBLEED))
13771382
return;
13781383

13791384
/* ITS can also enable stuffing */
@@ -1468,7 +1473,7 @@ static void __init retbleed_apply_mitigation(void)
14681473
}
14691474

14701475
if (mitigate_smt && !boot_cpu_has(X86_FEATURE_STIBP) &&
1471-
(retbleed_nosmt || cpu_mitigations_auto_nosmt()))
1476+
(retbleed_nosmt || smt_mitigations == SMT_MITIGATIONS_ON))
14721477
cpu_smt_disable(false);
14731478
}
14741479

0 commit comments

Comments
 (0)