Skip to content

Commit 7d459b4

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 ad17f07e95e6e8505e2153e5b391f0d27eacce25) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent c315094 commit 7d459b4

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
@@ -645,6 +645,9 @@
645645
#define MSR_AMD64_DC_CFG 0xc0011022
646646
#define MSR_AMD64_TW_CFG 0xc0011023
647647

648+
#define MSR_AMD64_FP_CFG 0xc0011028
649+
#define MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT 9
650+
648651
#define MSR_AMD64_DE_CFG 0xc0011029
649652
#define MSR_AMD64_DE_CFG_LFENCE_SERIALIZE_BIT 1
650653
#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
@@ -950,6 +950,9 @@ static void init_amd_zen1(struct cpuinfo_x86 *c)
950950
msr_clear_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT);
951951
clear_cpu_cap(c, X86_FEATURE_IRPERF);
952952
}
953+
954+
pr_notice_once("AMD Zen1 FPDSS bug detected, enabling mitigation.\n");
955+
msr_set_bit(MSR_AMD64_FP_CFG, MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT);
953956
}
954957

955958
static const struct x86_cpu_id amd_zenbleed_microcode[] = {

0 commit comments

Comments
 (0)