Skip to content

Commit d4932a1

Browse files
lrq-maxbp3tk0v
authored andcommitted
x86/bugs: Fix GDS mitigation selecting when mitigation is off
The current GDS mitigation logic incorrectly returns early when the attack vector mitigation is turned off, which leads to two problems: 1. CPUs without ARCH_CAP_GDS_CTRL support are incorrectly marked with GDS_MITIGATION_OFF when they should be marked as GDS_MITIGATION_UCODE_NEEDED. 2. The mitigation state checks and locking verification that follow are skipped, which means: - fail to detect if the mitigation was locked - miss the warning when trying to disable a locked mitigation Remove the early return to ensure proper mitigation state handling. This allows: - Proper mitigation classification for non-ARCH_CAP_GDS_CTRL CPUs - Complete mitigation state verification This also addresses the failed MSR 0x123 write attempt at boot on non-ARCH_CAP_GDS_CTRL CPUs: unchecked MSR access error: WRMSR to 0x123 (tried to write 0x0000000000000010) at rIP: ... (update_gds_msr) Call Trace: identify_secondary_cpu start_secondary common_startup_64 WARNING: CPU: 1 PID: 0 at arch/x86/kernel/cpu/bugs.c:1053 update_gds_msr [ bp: Massage, zap superfluous braces. ] Fixes: 8c7261a ("x86/bugs: Add attack vector controls for GDS") Suggested-by: Pawan Gupta <[email protected]> Signed-off-by: Li RongQing <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Pawan Gupta <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent e9576e0 commit d4932a1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/x86/kernel/cpu/bugs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,10 +1068,8 @@ static void __init gds_select_mitigation(void)
10681068
if (gds_mitigation == GDS_MITIGATION_AUTO) {
10691069
if (should_mitigate_vuln(X86_BUG_GDS))
10701070
gds_mitigation = GDS_MITIGATION_FULL;
1071-
else {
1071+
else
10721072
gds_mitigation = GDS_MITIGATION_OFF;
1073-
return;
1074-
}
10751073
}
10761074

10771075
/* No microcode */

0 commit comments

Comments
 (0)