Skip to content

Commit ad17f07

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 2d64618 commit ad17f07

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
@@ -949,6 +949,9 @@ static void init_amd_zen1(struct cpuinfo_x86 *c)
949949
msr_clear_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT);
950950
clear_cpu_cap(c, X86_FEATURE_IRPERF);
951951
}
952+
953+
pr_notice_once("AMD Zen1 FPDSS bug detected, enabling mitigation.\n");
954+
msr_set_bit(MSR_AMD64_FP_CFG, MSR_AMD64_FP_CFG_ZEN1_DENORM_FIX_BIT);
952955
}
953956

954957
static const struct x86_cpu_id amd_zenbleed_microcode[] = {

0 commit comments

Comments
 (0)