Skip to content

Commit eb78fe9

Browse files
bp3tk0vopsiff
authored andcommitted
x86/CPU: Fix FPDSS on Zen1
commit e55d98e7756135f32150b9b8f75d580d0d4b2dd3 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> (cherry picked from commit b731aca06387b195058a9f6449a03b62efa1bd10) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent d69f30e commit eb78fe9

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
@@ -639,6 +639,9 @@
639639
#define MSR_AMD64_DC_CFG 0xc0011022
640640
#define MSR_AMD64_TW_CFG 0xc0011023
641641

642+
#define MSR_AMD64_FP_CFG 0xc0011028
643+
#define MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT 9
644+
642645
#define MSR_AMD64_DE_CFG 0xc0011029
643646
#define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT 1
644647
#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)