Skip to contentSkip to conversation

x86/bugs: Fix SRSO reporting on Zen1/2 with SMT disabled

PATCH Applied Borislav Petkov 3 participants 3 messages May 13, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/bugs: Fix SRSO reporting on Zen1/2 with SMT disabled

From: "Borislav Petkov (AMD)" <[email protected]>

1f4bb068b498 ("x86/bugs: Restructure SRSO mitigation") does this:

  if (boot_cpu_data.x86 < 0x19 && !cpu_smt_possible()) {
          setup_force_cpu_cap(X86_FEATURE_SRSO_NO);
          srso_mitigation = SRSO_MITIGATION_NONE;
          return;
  }

and, in particular, sets srso_mitigation to NONE. This leads to reporting

Speculative Return Stack Overflow: Vulnerable

on Zen2 machines.

There's a far bigger confusion with what SRSO_NO means and how it is used in the code but this will be a matter of future fixes and restructuring to how the SRSO mitigation gets determined.

Fix the reporting issue for now.

---
 arch/x86/kernel/cpu/bugs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/bugs.c +3 -1
index 47c74c4ae206..dd8b50b4ceaa 100644
@@ -2942,7 +2942,9 @@ static void __init srso_update_mitigation(void)
 	    boot_cpu_has(X86_FEATURE_IBPB_BRTYPE))
 		srso_mitigation = SRSO_MITIGATION_IBPB;
 
-	if (boot_cpu_has_bug(X86_BUG_SRSO) && !cpu_mitigations_off())
+	if (boot_cpu_has_bug(X86_BUG_SRSO) &&
+	    !cpu_mitigations_off() &&
+	    !boot_cpu_has(X86_FEATURE_SRSO_NO))
 		pr_info("%s\n", srso_strings[srso_mitigation]);
 }
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 55 lines

-----Original Message-----
From: Borislav Petkov <[email protected]>
Sent: Tuesday, May 13, 2025 6:04 AM
To: Kaplan, David <[email protected]>
Cc: X86 ML <[email protected]>; LKML <[email protected]>; Borislav Petkov (AMD) <[email protected]>
Subject: [PATCH] x86/bugs: Fix SRSO reporting on Zen1/2 with SMT disabled

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

From: "Borislav Petkov (AMD)" <[email protected]>

1f4bb068b498 ("x86/bugs: Restructure SRSO mitigation") does this:

  if (boot_cpu_data.x86 < 0x19 && !cpu_smt_possible()) {
          setup_force_cpu_cap(X86_FEATURE_SRSO_NO);
          srso_mitigation = SRSO_MITIGATION_NONE;
          return;
  }

and, in particular, sets srso_mitigation to NONE. This leads to reporting

Speculative Return Stack Overflow: Vulnerable

on Zen2 machines.

There's a far bigger confusion with what SRSO_NO means and how it is used in the code but this will be a matter of future fixes and restructuring to how the SRSO mitigation gets determined.

Fix the reporting issue for now.

---
 arch/x86/kernel/cpu/bugs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/bugs.c index renamed from arch/x86/kernel/cpu/bugs.c +0 -0

47c74c4ae206..dd8b50b4ceaa 100644

arch/x86/kernel/cpu/bugs.c +3 -2
@@ -2942,7 +2942,9 @@ static void __init srso_update_mitigation(void)
            boot_cpu_has(X86_FEATURE_IBPB_BRTYPE))
                srso_mitigation = SRSO_MITIGATION_IBPB;
 
-       if (boot_cpu_has_bug(X86_BUG_SRSO) && !cpu_mitigations_off())
+       if (boot_cpu_has_bug(X86_BUG_SRSO) &&
+           !cpu_mitigations_off() &&
+           !boot_cpu_has(X86_FEATURE_SRSO_NO))
                pr_info("%s\n", srso_strings[srso_mitigation]);  }
 
--
Quoted 1 line

2.43.0

LGTM.

--David Kaplan

#2 lore raw
In reply to Borislav Petkov
The following commit has been merged into the x86/core branch of tip:

The following commit has been merged into the x86/core branch of tip:

Commit-ID:     891d3b8be32a69ae94d32e3f1e1ee01359020d49
Gitweb:        https://git.kernel.org/tip/891d3b8be32a69ae94d32e3f1e1ee01359020d49
Author:        Borislav Petkov (AMD) <[email protected]>
AuthorDate:    Tue, 13 May 2025 13:04:05 +02:00
Committer:     Borislav Petkov (AMD) <[email protected]>
CommitterDate: Tue, 13 May 2025 22:31:08 +02:00

x86/bugs: Fix SRSO reporting on Zen1/2 with SMT disabled

1f4bb068b498 ("x86/bugs: Restructure SRSO mitigation") does this:

  if (boot_cpu_data.x86 < 0x19 && !cpu_smt_possible()) {
          setup_force_cpu_cap(X86_FEATURE_SRSO_NO);
          srso_mitigation = SRSO_MITIGATION_NONE;
          return;
  }

and, in particular, sets srso_mitigation to NONE. This leads to reporting

Speculative Return Stack Overflow: Vulnerable

on Zen2 machines.

There's a far bigger confusion with what SRSO_NO means and how it is used in the code but this will be a matter of future fixes and restructuring to how the SRSO mitigation gets determined.

Fix the reporting issue for now.

---
 arch/x86/kernel/cpu/bugs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/bugs.c +3 -1
index 47c74c4..dd8b50b 100644
@@ -2942,7 +2942,9 @@ static void __init srso_update_mitigation(void)
 	    boot_cpu_has(X86_FEATURE_IBPB_BRTYPE))
 		srso_mitigation = SRSO_MITIGATION_IBPB;
 
-	if (boot_cpu_has_bug(X86_BUG_SRSO) && !cpu_mitigations_off())
+	if (boot_cpu_has_bug(X86_BUG_SRSO) &&
+	    !cpu_mitigations_off() &&
+	    !boot_cpu_has(X86_FEATURE_SRSO_NO))
 		pr_info("%s\n", srso_strings[srso_mitigation]);
 }