]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/rdrand: Disable RDSEED on AMD Cyan Skillfish
authorMikhail Paulyshka <me@mixaill.net>
Sat, 24 May 2025 14:53:19 +0000 (17:53 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2025 16:35:15 +0000 (18:35 +0200)
commit 5b937a1ed64ebeba8876e398110a5790ad77407c upstream.

AMD Cyan Skillfish (Family 17h, Model 47h, Stepping 0h) has an error that
causes RDSEED to always return 0xffffffff, while RDRAND works correctly.

Mask the RDSEED cap for this CPU so that both /proc/cpuinfo and direct CPUID
read report RDSEED as unavailable.

  [ bp: Move to amd.c, massage. ]

Signed-off-by: Mikhail Paulyshka <me@mixaill.net>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/20250524145319.209075-1-me@mixaill.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/msr-index.h
arch/x86/kernel/cpu/amd.c
tools/arch/x86/include/asm/msr-index.h

index 9fbad4cb971bff8f02f2c650119b5716f598381e..0338554575815905b8c4d92e5868393dd9151cef 100644 (file)
 #define MSR_AMD64_OSVW_STATUS          0xc0010141
 #define MSR_AMD_PPIN_CTL               0xc00102f0
 #define MSR_AMD_PPIN                   0xc00102f1
+#define MSR_AMD64_CPUID_FN_7           0xc0011002
 #define MSR_AMD64_CPUID_FN_1           0xc0011004
 #define MSR_AMD64_LS_CFG               0xc0011020
 #define MSR_AMD64_DC_CFG               0xc0011022
index f6690df70b43eadc07ae6e74482c0765f9cb7560..5fcdfbb792bd9f9363e3f6672926241e9738c535 100644 (file)
@@ -1154,6 +1154,13 @@ static void init_amd_zen2(struct cpuinfo_x86 *c)
 {
        fix_erratum_1386(c);
        zen2_zenbleed_check(c);
+
+       /* Disable RDSEED on AMD Cyan Skillfish because of an error. */
+       if (c->x86_model == 0x47 && c->x86_stepping == 0x0) {
+               clear_cpu_cap(c, X86_FEATURE_RDSEED);
+               msr_clear_bit(MSR_AMD64_CPUID_FN_7, 18);
+               pr_emerg("RDSEED is not reliable on this platform; disabling.\n");
+       }
 }
 
 static void init_amd_zen3(struct cpuinfo_x86 *c)
index 1d111350197f3169a8eec402d77980dd617c6b95..76f9cad9fb62b190d733a90e017f92b7dbe72a4c 100644 (file)
 #define MSR_AMD64_OSVW_STATUS          0xc0010141
 #define MSR_AMD_PPIN_CTL               0xc00102f0
 #define MSR_AMD_PPIN                   0xc00102f1
+#define MSR_AMD64_CPUID_FN_7           0xc0011002
 #define MSR_AMD64_CPUID_FN_1           0xc0011004
 #define MSR_AMD64_LS_CFG               0xc0011020
 #define MSR_AMD64_DC_CFG               0xc0011022