]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/CPU: Fix FPDSS on Zen1
authorBorislav Petkov (AMD) <bp@alien8.de>
Tue, 7 Apr 2026 09:40:03 +0000 (11:40 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Apr 2026 13:04:42 +0000 (06:04 -0700)
Zen1's hardware divider can leave, under certain circumstances, partial
results from previous operations.  Those results can be leaked by
another, attacker thread.

Fix that with a chicken bit.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86/include/asm/msr-index.h
arch/x86/kernel/cpu/amd.c

index 9dc6b610e4e2e9ca1bfa7e59ad280ba211a236c0..a14a0f43e04ae8d205f90aefbeb38e2786e8220a 100644 (file)
 #define MSR_AMD64_DC_CFG               0xc0011022
 #define MSR_AMD64_TW_CFG               0xc0011023
 
+#define MSR_AMD64_FP_CFG               0xc0011028
+#define MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT   9
+
 #define MSR_AMD64_DE_CFG               0xc0011029
 #define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT   1
 #define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE      BIT_ULL(MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT)
index 33b740c26bef1b73ff8b06278c3479d876887f6e..2d9ae6ab1701c0a5add983e63168bb74f567d899 100644 (file)
@@ -944,6 +944,9 @@ static void init_amd_zen1(struct cpuinfo_x86 *c)
                msr_clear_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT);
                clear_cpu_cap(c, X86_FEATURE_IRPERF);
        }
+
+       pr_notice_once("AMD Zen1 FPDSS bug detected, enabling mitigation.\n");
+       msr_set_bit(MSR_AMD64_FP_CFG, MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT);
 }
 
 static const struct x86_cpu_id amd_zenbleed_microcode[] = {