* [PATCH][v3] x86/bugs: Fix GDS mitigation selecting when mitigation is off
@ 2025-08-19 2:33 lirongqing
2025-08-19 5:28 ` Pawan Gupta
2025-08-19 9:11 ` [tip: x86/urgent] " tip-bot2 for Li RongQing
0 siblings, 2 replies; 3+ messages in thread
From: lirongqing @ 2025-08-19 2:33 UTC (permalink / raw)
To: tglx, bp, peterz, jpoimboe, pawan.kumar.gupta, mingo, dave.hansen,
x86, hpa, david.kaplan, linux-kernel
Cc: Li RongQing
From: Li RongQing <lirongqing@baidu.com>
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
The change fixes the following runtime issues because mitigation is off
in non-ARCH_CAP_GDS_CTRL CPUs:
[ 2.809147] unchecked MSR access error: WRMSR to 0x123 (tried to write 0x0000000000000010) at rIP: 0xffffffffb34527b8 (update_gds_msr+0x38/0xe0)
[ 2.809147] Call Trace:
[ 2.809147] <TASK>
[ 2.809147] identify_secondary_cpu+0x72/0x90
[ 2.809147] start_secondary+0x7a/0x140
[ 2.809147] common_startup_64+0x13e/0x141
[ 2.809147] </TASK>
[ 2.809147] ------------[ cut here ]------------
[ 2.809147] WARNING: CPU: 1 PID: 0 at arch/x86/kernel/cpu/bugs.c:1053 update_gds_msr+0x9b/0xe0
Fixes: 8c7261abcb7ad ("x86/bugs: Add attack vector controls for GDS")
Suggested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
Diff with v2: refine the commit header and Reviewed-by: Pawan Gupta
Diff with v1: directly remove return
arch/x86/kernel/cpu/bugs.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index b74bf93..9e0b9bf 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1071,7 +1071,6 @@ static void __init gds_select_mitigation(void)
gds_mitigation = GDS_MITIGATION_FULL;
else {
gds_mitigation = GDS_MITIGATION_OFF;
- return;
}
}
--
2.9.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][v3] x86/bugs: Fix GDS mitigation selecting when mitigation is off
2025-08-19 2:33 [PATCH][v3] x86/bugs: Fix GDS mitigation selecting when mitigation is off lirongqing
@ 2025-08-19 5:28 ` Pawan Gupta
2025-08-19 9:11 ` [tip: x86/urgent] " tip-bot2 for Li RongQing
1 sibling, 0 replies; 3+ messages in thread
From: Pawan Gupta @ 2025-08-19 5:28 UTC (permalink / raw)
To: lirongqing
Cc: tglx, bp, peterz, jpoimboe, mingo, dave.hansen, x86, hpa,
david.kaplan, linux-kernel
On Tue, Aug 19, 2025 at 10:33:56AM +0800, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> 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
>
> The change fixes the following runtime issues because mitigation is off
> in non-ARCH_CAP_GDS_CTRL CPUs:
>
> [ 2.809147] unchecked MSR access error: WRMSR to 0x123 (tried to write 0x0000000000000010) at rIP: 0xffffffffb34527b8 (update_gds_msr+0x38/0xe0)
> [ 2.809147] Call Trace:
> [ 2.809147] <TASK>
> [ 2.809147] identify_secondary_cpu+0x72/0x90
> [ 2.809147] start_secondary+0x7a/0x140
> [ 2.809147] common_startup_64+0x13e/0x141
> [ 2.809147] </TASK>
> [ 2.809147] ------------[ cut here ]------------
> [ 2.809147] WARNING: CPU: 1 PID: 0 at arch/x86/kernel/cpu/bugs.c:1053 update_gds_msr+0x9b/0xe0
>
> Fixes: 8c7261abcb7ad ("x86/bugs: Add attack vector controls for GDS")
> Suggested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> Diff with v2: refine the commit header and Reviewed-by: Pawan Gupta
> Diff with v1: directly remove return
>
> arch/x86/kernel/cpu/bugs.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index b74bf93..9e0b9bf 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -1071,7 +1071,6 @@ static void __init gds_select_mitigation(void)
> gds_mitigation = GDS_MITIGATION_FULL;
> else {
> gds_mitigation = GDS_MITIGATION_OFF;
> - return;
> }
With the "return" gone, braces are not needed in the "else" block (although
it is a bit strange to have braces only in the "else" block to begin with).
Sorry, I missed to spot that in the previous review.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: x86/urgent] x86/bugs: Fix GDS mitigation selecting when mitigation is off
2025-08-19 2:33 [PATCH][v3] x86/bugs: Fix GDS mitigation selecting when mitigation is off lirongqing
2025-08-19 5:28 ` Pawan Gupta
@ 2025-08-19 9:11 ` tip-bot2 for Li RongQing
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Li RongQing @ 2025-08-19 9:11 UTC (permalink / raw)
To: linux-tip-commits
Cc: Pawan Gupta, Li RongQing, Borislav Petkov (AMD), x86,
linux-kernel
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: d4932a1b148bb6121121e56bad312c4339042d70
Gitweb: https://git.kernel.org/tip/d4932a1b148bb6121121e56bad312c4339042d70
Author: Li RongQing <lirongqing@baidu.com>
AuthorDate: Tue, 19 Aug 2025 10:33:56 +08:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Tue, 19 Aug 2025 10:38:04 +02:00
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: 8c7261abcb7ad ("x86/bugs: Add attack vector controls for GDS")
Suggested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Link: https://lore.kernel.org/20250819023356.2012-1-lirongqing@baidu.com
---
arch/x86/kernel/cpu/bugs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 2186a77..49ef1b8 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1068,10 +1068,8 @@ static void __init gds_select_mitigation(void)
if (gds_mitigation == GDS_MITIGATION_AUTO) {
if (should_mitigate_vuln(X86_BUG_GDS))
gds_mitigation = GDS_MITIGATION_FULL;
- else {
+ else
gds_mitigation = GDS_MITIGATION_OFF;
- return;
- }
}
/* No microcode */
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-19 9:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-19 2:33 [PATCH][v3] x86/bugs: Fix GDS mitigation selecting when mitigation is off lirongqing
2025-08-19 5:28 ` Pawan Gupta
2025-08-19 9:11 ` [tip: x86/urgent] " tip-bot2 for Li RongQing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).