x86/CPU/AMD: Do not leak quotient data after a division by 0
authorBorislav Petkov (AMD) <bp@alien8.de>
Fri, 4 Aug 2023 22:06:43 +0000 (00:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 10:08:27 +0000 (12:08 +0200)
commitf2615bb47be4f53be92c81a6a8aa286c92ef04d9
tree65923b11a5ae545f324e294c28efdb07938ba338
parent673cdde74fd13fff0acc4c6c41f5f949434156a5
x86/CPU/AMD: Do not leak quotient data after a division by 0

commit 77245f1c3c6495521f6a3af082696ee2f8ce3921 upstream.

Under certain circumstances, an integer division by 0 which faults, can
leave stale quotient data from a previous division operation on Zen1
microarchitectures.

Do a dummy division 0/1 before returning from the #DE exception handler
in order to avoid any leaks of potentially sensitive data.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: <stable@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/cpufeatures.h
arch/x86/include/asm/processor.h
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/traps.c