1
0
Fork 0
alistair23-linux/arch/x86/kernel/fpu
Petteri Aimonen c4db485dd3 x86/fpu: Reset MXCSR to default in kernel_fpu_begin()
[ Upstream commit 7ad816762f ]

Previously, kernel floating point code would run with the MXCSR control
register value last set by userland code by the thread that was active
on the CPU core just before kernel call. This could affect calculation
results if rounding mode was changed, or a crash if a FPU/SIMD exception
was unmasked.

Restore MXCSR to the kernel's default value.

 [ bp: Carve out from a bigger patch by Petteri, add feature check, add
   FNINIT call too (amluto). ]

Signed-off-by: Petteri Aimonen <jpa@git.mail.kapsi.fi>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=207979
Link: https://lkml.kernel.org/r/20200624114646.28953-2-bp@alien8.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-07-22 09:32:51 +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: Reset MXCSR to default in kernel_fpu_begin() 2020-07-22 09:32:51 +02:00
init.c x86/fpu: Inline fpu__xstate_clear_all_cpu_caps() 2019-07-07 12:01:47 +02:00
regset.c x86/fpu: Remove fpu->initialized 2019-04-10 15:42:40 +02:00
signal.c x86/fpu: Deactivate FPU state after failure during state load 2020-02-24 08:36:26 +01:00
xstate.c copy_xstate_to_kernel(): don't leave parts of destination uninitialized 2020-06-03 08:21:30 +02:00