Skip to content

Commit 1dbb6b1

Browse files
dkaplan2bp3tk0v
authored andcommitted
x86/bugs: Fix handling when SRSO mitigation is disabled
When the SRSO mitigation is disabled, either via mitigations=off or spec_rstack_overflow=off, the warning about the lack of IBPB-enhancing microcode is printed anyway. This is unnecessary since the user has turned off the mitigation. [ bp: Massage, drop SBPB rationale as it doesn't matter because when mitigations are disabled x86_pred_cmd is not being used anyway. ] Signed-off-by: David Kaplan <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 23e12b5 commit 1dbb6b1

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,10 +2557,9 @@ static void __init srso_select_mitigation(void)
25572557
{
25582558
bool has_microcode = boot_cpu_has(X86_FEATURE_IBPB_BRTYPE);
25592559

2560-
if (cpu_mitigations_off())
2561-
return;
2562-
2563-
if (!boot_cpu_has_bug(X86_BUG_SRSO)) {
2560+
if (!boot_cpu_has_bug(X86_BUG_SRSO) ||
2561+
cpu_mitigations_off() ||
2562+
srso_cmd == SRSO_CMD_OFF) {
25642563
if (boot_cpu_has(X86_FEATURE_SBPB))
25652564
x86_pred_cmd = PRED_CMD_SBPB;
25662565
return;
@@ -2591,11 +2590,6 @@ static void __init srso_select_mitigation(void)
25912590
}
25922591

25932592
switch (srso_cmd) {
2594-
case SRSO_CMD_OFF:
2595-
if (boot_cpu_has(X86_FEATURE_SBPB))
2596-
x86_pred_cmd = PRED_CMD_SBPB;
2597-
return;
2598-
25992593
case SRSO_CMD_MICROCODE:
26002594
if (has_microcode) {
26012595
srso_mitigation = SRSO_MITIGATION_MICROCODE;
@@ -2649,6 +2643,8 @@ static void __init srso_select_mitigation(void)
26492643
pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");
26502644
}
26512645
break;
2646+
default:
2647+
break;
26522648
}
26532649

26542650
out:

0 commit comments

Comments
 (0)