WSL2-Linux-Kernel/arch/x86/kernel/fpu
Uros Bizjak 8607d7ccbf x86/fpu: Fix AMD X86_BUG_FXSAVE_LEAK fixup
[ Upstream commit 5d31174f3c8c465d9dbe88f6b9d1fe5716f44981 ]

The assembly snippet in restore_fpregs_from_fpstate() that implements
X86_BUG_FXSAVE_LEAK fixup loads the value from a random variable,
preferably the one that is already in the L1 cache.

However, the access to fpinit_state via *fpstate pointer is not
implemented correctly. The "m" asm constraint requires dereferenced
pointer variable, otherwise the compiler just reloads the value
via temporary stack slot. The current asm code reflects this:

     mov    %rdi,(%rsp)
     ...
     fildl  (%rsp)

With dereferenced pointer variable, the code does what the
comment above the asm snippet says:

     fildl  (%rdi)

Also, remove the pointless %P operand modifier. The modifier is
ineffective on non-symbolic references - it was used to prevent
%rip-relative addresses in .altinstr sections, but FILDL in the
.text section can use %rip-relative addresses without problems.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20240315081849.5187-1-ubizjak@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-05 09:14:43 +02:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
bugs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
core.c x86/fpu: Fix AMD X86_BUG_FXSAVE_LEAK fixup 2024-07-05 09:14:43 +02:00
init.c x86/fpu: Mark init functions __init 2023-08-08 19:58:32 +02:00
regset.c x86/fpu: Add a pkru argument to copy_uabi_from_kernel_to_xstate(). 2023-01-14 10:23:27 +01:00
signal.c x86/fpu: Stop relying on userspace for info to fault in xsave buffer 2024-03-01 13:21:43 +01:00
xstate.c x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4 2023-08-30 16:18:19 +02:00