Skip to content

Commit 1fd5eb0

Browse files
dkaplan2Ingo Molnar
authored andcommitted
x86/bugs: Add SRSO_MITIGATION_NOSMT
AMD Zen1 and Zen2 CPUs with SMT disabled are not vulnerable to SRSO. Instead of overloading the X86_FEATURE_SRSO_NO bit to indicate this, define a separate mitigation to make the code cleaner. Signed-off-by: David Kaplan <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Borislav Petkov (AMD) <[email protected]> Cc: H . Peter Anvin <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Pawan Gupta <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ab9f238 commit 1fd5eb0

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,6 +2851,7 @@ enum srso_mitigation {
28512851
SRSO_MITIGATION_UCODE_NEEDED,
28522852
SRSO_MITIGATION_SAFE_RET_UCODE_NEEDED,
28532853
SRSO_MITIGATION_MICROCODE,
2854+
SRSO_MITIGATION_NOSMT,
28542855
SRSO_MITIGATION_SAFE_RET,
28552856
SRSO_MITIGATION_IBPB,
28562857
SRSO_MITIGATION_IBPB_ON_VMEXIT,
@@ -2862,6 +2863,7 @@ static const char * const srso_strings[] = {
28622863
[SRSO_MITIGATION_UCODE_NEEDED] = "Vulnerable: No microcode",
28632864
[SRSO_MITIGATION_SAFE_RET_UCODE_NEEDED] = "Vulnerable: Safe RET, no microcode",
28642865
[SRSO_MITIGATION_MICROCODE] = "Vulnerable: Microcode, no safe RET",
2866+
[SRSO_MITIGATION_NOSMT] = "Mitigation: SMT disabled",
28652867
[SRSO_MITIGATION_SAFE_RET] = "Mitigation: Safe RET",
28662868
[SRSO_MITIGATION_IBPB] = "Mitigation: IBPB",
28672869
[SRSO_MITIGATION_IBPB_ON_VMEXIT] = "Mitigation: IBPB on VMEXIT only",
@@ -2914,8 +2916,7 @@ static void __init srso_select_mitigation(void)
29142916
* IBPB microcode has been applied.
29152917
*/
29162918
if (boot_cpu_data.x86 < 0x19 && !cpu_smt_possible()) {
2917-
setup_force_cpu_cap(X86_FEATURE_SRSO_NO);
2918-
srso_mitigation = SRSO_MITIGATION_NONE;
2919+
srso_mitigation = SRSO_MITIGATION_NOSMT;
29192920
return;
29202921
}
29212922
} else {
@@ -2968,8 +2969,7 @@ static void __init srso_update_mitigation(void)
29682969
srso_mitigation = SRSO_MITIGATION_IBPB;
29692970

29702971
if (boot_cpu_has_bug(X86_BUG_SRSO) &&
2971-
!cpu_mitigations_off() &&
2972-
!boot_cpu_has(X86_FEATURE_SRSO_NO))
2972+
!cpu_mitigations_off())
29732973
pr_info("%s\n", srso_strings[srso_mitigation]);
29742974
}
29752975

@@ -3265,9 +3265,6 @@ static ssize_t retbleed_show_state(char *buf)
32653265

32663266
static ssize_t srso_show_state(char *buf)
32673267
{
3268-
if (boot_cpu_has(X86_FEATURE_SRSO_NO))
3269-
return sysfs_emit(buf, "Mitigation: SMT disabled\n");
3270-
32713268
return sysfs_emit(buf, "%s\n", srso_strings[srso_mitigation]);
32723269
}
32733270

0 commit comments

Comments
 (0)