Skip to content

Commit eda718f

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

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
@@ -3123,14 +3123,19 @@ early_param("spec_rstack_overflow", srso_parse_cmdline);
31233123

31243124
static void __init srso_select_mitigation(void)
31253125
{
3126-
if (!boot_cpu_has_bug(X86_BUG_SRSO) || cpu_mitigations_off())
3126+
if (!boot_cpu_has_bug(X86_BUG_SRSO)) {
31273127
srso_mitigation = SRSO_MITIGATION_NONE;
3128-
3129-
if (srso_mitigation == SRSO_MITIGATION_NONE)
31303128
return;
3129+
}
31313130

3132-
if (srso_mitigation == SRSO_MITIGATION_AUTO)
3133-
srso_mitigation = SRSO_MITIGATION_SAFE_RET;
3131+
if (srso_mitigation == SRSO_MITIGATION_AUTO) {
3132+
if (should_mitigate_vuln(X86_BUG_SRSO)) {
3133+
srso_mitigation = SRSO_MITIGATION_SAFE_RET;
3134+
} else {
3135+
srso_mitigation = SRSO_MITIGATION_NONE;
3136+
return;
3137+
}
3138+
}
31343139

31353140
/* Zen1/2 with SMT off aren't vulnerable to SRSO. */
31363141
if (boot_cpu_data.x86 < 0x19 && !cpu_smt_possible()) {

0 commit comments

Comments
 (0)