Skip to content

Commit b731aca

Browse files
bp3tk0vgregkh
authored andcommitted
x86/CPU: Fix FPDSS on Zen1
commit e55d98e upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ed91805 commit b731aca

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

arch/x86/include/asm/msr-index.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,9 @@
628628
#define MSR_AMD64_DC_CFG 0xc0011022
629629
#define MSR_AMD64_TW_CFG 0xc0011023
630630

631+
#define MSR_AMD64_FP_CFG 0xc0011028
632+
#define MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT 9
633+
631634
#define MSR_AMD64_DE_CFG 0xc0011029
632635
#define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT 1
633636
#define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE BIT_ULL(MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT)

arch/x86/kernel/cpu/amd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,9 @@ static void init_amd_zen1(struct cpuinfo_x86 *c)
935935
msr_clear_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT);
936936
clear_cpu_cap(c, X86_FEATURE_IRPERF);
937937
}
938+
939+
pr_notice_once("AMD Zen1 FPDSS bug detected, enabling mitigation.\n");
940+
msr_set_bit(MSR_AMD64_FP_CFG, MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT);
938941
}
939942

940943
static bool cpu_has_zenbleed_microcode(void)

0 commit comments

Comments
 (0)