Skip to contentSkip to conversation

x86/ucode: Exclude Zen6 from entrysign mitigations

PATCH In review Andrew Cooper 2 participants 3 messages Mar 16 – Mar 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/ucode: Exclude Zen6 from entrysign mitigations

Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be vulnerable to entrysign.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

This does want backporting, but it depends on 8e4775d118c327 which collects leaf 7a1 early enough to be used in this way. So, it should hold off for the moment until the FRED backports are finalised.

---
 xen/arch/x86/cpu/microcode/amd.c | 6 ++++--
 xen/arch/x86/include/asm/amd.h   | 4 ++++
 2 files changed, 8 insertions(+), 2 deletions(-)
xen/arch/x86/cpu/microcode/amd.c +4 -2
index 90f10ac8be37..2ba1fa825f2f 100644
@@ -20,6 +20,7 @@
 #include <xen/mm.h> /* TODO: Fix asm/tlbflush.h breakage */
 #include <xen/sha2.h>
 
+#include <asm/amd.h>
 #include <asm/msr.h>
 
 #include "private.h"
@@ -576,7 +577,7 @@ void __init ucode_probe_amd(struct microcode_ops *ops)
      */
     if ( IS_ENABLED(CONFIG_MICROCODE_LOADING) &&
          boot_cpu_data.family >= 0x17 && boot_cpu_data.family <= 0x1a &&
-         !opt_digest_check )
+         !is_zen6_uarch() && !opt_digest_check )
     {
         printk(XENLOG_WARNING
                "Microcode patch additional digest checks disabled\n");
@@ -618,7 +619,8 @@ void __init amd_check_entrysign(void)
     if ( !IS_ENABLED(CONFIG_MICROCODE_LOADING)  ||
          boot_cpu_data.vendor != X86_VENDOR_AMD ||
          boot_cpu_data.family < 0x17            ||
-         boot_cpu_data.family > 0x1a )
+         boot_cpu_data.family > 0x1a            ||
+         is_zen6_uarch() )
         return;
 
     /*
xen/arch/x86/include/asm/amd.h +4 -0
index 4036dd549835..d21df0741a32 100644
@@ -59,6 +59,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -66,6 +68,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)
 
 struct cpuinfo_x86;
 int cpu_has_amd_erratum(const struct cpuinfo_x86 *cpu, int osvw_id, ...);
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Andrew Cooper

Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be vulnerable to entrysign.

Quoted 3 lines

This does want backporting, but it depends on 8e4775d118c327 which collects leaf 7a1 early enough to be used in this way. So, it should hold off for the moment until the FRED backports are finalised.

Okay.

Quoted 12 lines
xen/arch/x86/include/asm/amd.h +2 -0
@@ -59,6 +59,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */

xen/arch/x86/include/asm/amd.h line 72

Quoted 5 lines
xen/arch/x86/include/asm/amd.h +2 -0
@@ -66,6 +68,8 @@
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)

A more general remark here: This, I think, is one of the (rare) cases where we may want to use the raw CPU policy, for the distinction to remain unaffected by "cpuid=" command line options. Thoughts?

Jan

#2 lore raw
Quoted 6 lines · Jan Beulich
Quoted 4 lines · Andrew Cooper

Family 0x1a covers both Zen5 and Zen6, but the latter is not believed to be vulnerable to entrysign.

Thanks.

Quoted 18 lines
Quoted 4 lines

This does want backporting, but it depends on 8e4775d118c327 which collects leaf 7a1 early enough to be used in this way. So, it should hold off for the moment until the FRED backports are finalised.

Okay.

Quoted 12 lines
xen/arch/x86/include/asm/amd.h +2 -0
@@ -59,6 +59,8 @@
  * For Zen3 and Zen4 (Fam19h) the heuristic is the presence of AutoIBRS, as
  * it's Zen4-specific.
  *
+ * For Zen5 and Zen6 (Fam1ah) the heuristic is the presence of FRED.
+ *
  * The caller is required to perform the appropriate vendor/family checks
  * first.
  */
@@ -66,6 +68,8 @@
Quoted 8 lines

xen/arch/x86/include/asm/amd.h line 72

Quoted 5 lines
xen/arch/x86/include/asm/amd.h +2 -0
 #define is_zen2_uarch()   boot_cpu_has(X86_FEATURE_AMD_STIBP)
 #define is_zen3_uarch() (!boot_cpu_has(X86_FEATURE_AUTO_IBRS))
 #define is_zen4_uarch()   boot_cpu_has(X86_FEATURE_AUTO_IBRS)
+#define is_zen5_uarch() (!boot_cpu_has(X86_FEATURE_FRED))
+#define is_zen6_uarch()   boot_cpu_has(X86_FEATURE_FRED)

A more general remark here: This, I think, is one of the (rare) cases where we may want to use the raw CPU policy, for the distinction to remain unaffected by "cpuid=" command line options. Thoughts?

Yes, that's the plan, but raw is still collected too late right now. This is on the todo list.

~Andrew