summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/entry-common.h
diff options
context:
space:
mode:
authorBorislav Petkov (AMD) <bp@alien8.de>2023-08-12 00:38:24 +0300
committerBorislav Petkov (AMD) <bp@alien8.de>2023-08-14 12:02:50 +0300
commitf58d6fbcb7c848b7f2469be339bc571f2e9d245b (patch)
tree3b81ac3f3377f0d180d29afb19e0b531853a8c4f /arch/x86/include/asm/entry-common.h
parentba5ca5e5e6a1d55923e88b4a83da452166f5560e (diff)
downloadlinux-f58d6fbcb7c848b7f2469be339bc571f2e9d245b.tar.xz
x86/CPU/AMD: Fix the DIV(0) initial fix attempt
Initially, it was thought that doing an innocuous division in the #DE handler would take care to prevent any leaking of old data from the divider but by the time the fault is raised, the speculation has already advanced too far and such data could already have been used by younger operations. Therefore, do the innocuous division on every exit to userspace so that userspace doesn't see any potentially old data from integer divisions in kernel space. Do the same before VMRUN too, to protect host data from leaking into the guest too. Fixes: 77245f1c3c64 ("x86/CPU/AMD: Do not leak quotient data after a division by 0") Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Cc: <stable@kernel.org> Link: https://lore.kernel.org/r/20230811213824.10025-1-bp@alien8.de
Diffstat (limited to 'arch/x86/include/asm/entry-common.h')
-rw-r--r--arch/x86/include/asm/entry-common.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/include/asm/entry-common.h b/arch/x86/include/asm/entry-common.h
index 117903881fe4..ce8f50192ae3 100644
--- a/arch/x86/include/asm/entry-common.h
+++ b/arch/x86/include/asm/entry-common.h
@@ -92,6 +92,7 @@ static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
static __always_inline void arch_exit_to_user_mode(void)
{
mds_user_clear_cpu_buffers();
+ amd_clear_divider();
}
#define arch_exit_to_user_mode arch_exit_to_user_mode