FAILED: patch "[PATCH] x86/CPU/AMD: Add RDSEED fix for Zen5" failed to apply to 6.12-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 607b9fb2ce248cc5b633c5949e0153838992c152
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025110202-attendant-curtain-cd04@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 607b9fb2ce248cc5b633c5949e0153838992c152 Mon Sep 17 00:00:00 2001
From: Gregory Price <[email protected]>
Date: Mon, 20 Oct 2025 11:13:55 +0200
Subject: [PATCH] x86/CPU/AMD: Add RDSEED fix for Zen5
There's an issue with RDSEED's 16-bit and 32-bit register output variants on Zen5 which return a random value of 0 "at a rate inconsistent with randomness while incorrectly signaling success (CF=1)". Search the web for AMD-SB-7055 for more detail.
Add a fix glue which checks microcode revisions.
[ bp: Add microcode revisions checking, rewrite. ]
arch/x86/kernel/cpu/amd.c +10 -0
@@ -1035,8 +1035,18 @@ static void init_amd_zen4(struct cpuinfo_x86 *c) } } +static const struct x86_cpu_id zen5_rdseed_microcode[] = { +ZEN_MODEL_STEP_UCODE (0x1a ,0x02 ,0x1 ,0x0b00215a ), +ZEN_MODEL_STEP_UCODE (0x1a ,0x11 ,0x0 ,0x0b101054 ), +}; +static void init_amd_zen5 (struct cpuinfo_x86 *c) { +if (!x86_match_min_microcode_rev (zen5_rdseed_microcode)) { +clear_cpu_cap (c,X86_FEATURE_RDSEED ); +msr_clear_bit (MSR_AMD64_CPUID_FN_7 ,18 ); +pr_emerg_once ("RDSEED32 is broken. Disabling the corresponding CPUID bit.\n" ); + } }static void init_amd (struct cpuinfo_x86 *c)
Borislav Petkov
maintainerReview
Quoted 4 lines · On Sun, Nov 02, 2025 at 11:19:02PM +0900, [email protected] wrote:
(quoted diff) +4
-0+static const struct x86_cpu_id zen5_rdseed_microcode[] = { + ZEN_MODEL_STEP_UCODE(0x1a, 0x02, 0x1, 0x0b00215a), + ZEN_MODEL_STEP_UCODE(0x1a, 0x11, 0x0, 0x0b101054), +};
Yeah, we don't have that min microcode gunk with the device_id match so we'll have to do something like we did for TSA. I.e., below.
I'll test it tomorrow to make sure it doesn't do any cat incinerations :-P
---
arch/x86/kernel/cpu/amd.c +30 -5
@@ -1018,14 +1018,39 @@ static void init_amd_zen4(struct cpuinfo_x86 *c) } } -static const struct x86_cpu_id zen5_rdseed_microcode[] = { -ZEN_MODEL_STEP_UCODE (0x1a ,0x02 ,0x1 ,0x0b00215a ), -ZEN_MODEL_STEP_UCODE (0x1a ,0x11 ,0x0 ,0x0b101054 ), -}; +static bool check_rdseed_microcode (void ) +{ +struct cpuinfo_x86 *c = &boot_cpu_data; +union zen_patch_rev p; +u32 min_rev =0 ; + + p.ext_fam = c->x86 -0xf ; + p.model = c->x86_model; + p.ext_model = c->x86_model >>4 ; + p.stepping = c->x86_stepping; +/* reserved bits are expected to be 0 in test below */ + p.__reserved =0 ; + +if (cpu_has (c,X86_FEATURE_ZEN5 )) { +switch (p.ucode_rev >>8 ) { +case 0xb0021 : min_rev =0xb00215a ;break ; +case 0xb1010 : min_rev =0xb101054 ;break ; +default : +pr_debug ("%s: ucode_rev: 0x%x, current revision: 0x%x\n" , + __func__, p.ucode_rev, c->microcode); +return false; + } + } + +if (!min_rev) +return false; + +return c->microcode >= min_rev; +}static void init_amd_zen5 (struct cpuinfo_x86 *c) { -if (!x86_match_min_microcode_rev (zen5_rdseed_microcode)) { +if (!check_rdseed_microcode ()) {clear_cpu_cap (c,X86_FEATURE_RDSEED );msr_clear_bit (MSR_AMD64_CPUID_FN_7 ,18 );pr_emerg_once ("RDSEED32 is broken. Disabling the corresponding CPUID bit.\n" );
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteGreg KH
maintainerQuoted 10 lines · Borislav Petkov
Review
Quoted 4 lines · On Sun, Nov 02, 2025 at 11:19:02PM +0900, [email protected] wrote:
(quoted diff) +4
-0+static const struct x86_cpu_id zen5_rdseed_microcode[] = { + ZEN_MODEL_STEP_UCODE(0x1a, 0x02, 0x1, 0x0b00215a), + ZEN_MODEL_STEP_UCODE(0x1a, 0x11, 0x0, 0x0b101054), +};Yeah, we don't have that min microcode gunk with the
device_idmatch so we'll have to do something like we did for TSA. I.e., below.I'll test it tomorrow to make sure it doesn't do any cat incinerations :-P
No worries. Don't know if you want this for any other stable kernels older than that, but it didn't apply there either :)
thanks,
greg k-h
Borislav Petkov
maintainerQuoted 2 lines · Greg KH
No worries. Don't know if you want this for any other stable kernels older than that, but it didn't apply there either :)
Yeah, something even older running Zen5...? Meh, I'll say "no need" and I betcha someone would promptly crawl out of the woodwork, hand'a'raisin'...
:-P
Let's see what actually happens.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteBorislav Petkov
maintainerPATCH 1/1 x86/CPU/AMD: Add RDSEED fix for Zen5
From: Gregory Price <[email protected]>
Subject: [PATCH] x86/CPU/AMD: Add RDSEED fix for Zen5
Commit 607b9fb2ce248cc5b633c5949e0153838992c152 upstream.
There's an issue with RDSEED's 16-bit and 32-bit register output variants on Zen5 which return a random value of 0 "at a rate inconsistent with randomness while incorrectly signaling success (CF=1)". Search the web for AMD-SB-7055 for more detail.
Add a fix glue which checks microcode revisions.
[ bp: Add microcode revisions checking, rewrite. ]
[ bp: 6.12 backport: use the alternative microcode version checking. ]
--- arch/x86/kernel/cpu/amd.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
arch/x86/kernel/cpu/amd.c +35 -0
@@ -1018,8 +1018,43 @@ static void init_amd_zen4(struct cpuinfo_x86 *c) } } +static bool check_rdseed_microcode (void ) +{ +struct cpuinfo_x86 *c = &boot_cpu_data; +union zen_patch_rev p; +u32 min_rev =0 ; + + p.ext_fam = c->x86 -0xf ; + p.model = c->x86_model; + p.ext_model = c->x86_model >>4 ; + p.stepping = c->x86_stepping; +/* reserved bits are expected to be 0 in test below */ + p.__reserved =0 ; + +if (cpu_has (c,X86_FEATURE_ZEN5 )) { +switch (p.ucode_rev >>8 ) { +case 0xb0021 : min_rev =0xb00215a ;break ; +case 0xb1010 : min_rev =0xb101054 ;break ; +default : +pr_debug ("%s: ucode_rev: 0x%x, current revision: 0x%x\n" , + __func__, p.ucode_rev, c->microcode); +return false; + } + } + +if (!min_rev) +return false; + +return c->microcode >= min_rev; +} +static void init_amd_zen5 (struct cpuinfo_x86 *c) { +if (!check_rdseed_microcode ()) { +clear_cpu_cap (c,X86_FEATURE_RDSEED ); +msr_clear_bit (MSR_AMD64_CPUID_FN_7 ,18 ); +pr_emerg_once ("RDSEED32 is broken. Disabling the corresponding CPUID bit.\n" ); + } }static void init_amd (struct cpuinfo_x86 *c)
Signature · 8 lines
2.51.0
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette