Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4db485d authored by Petteri Aimonen's avatar Petteri Aimonen Committed by Greg Kroah-Hartman
Browse files

x86/fpu: Reset MXCSR to default in kernel_fpu_begin()



[ Upstream commit 7ad816762f9bf89e940e618ea40c43138b479e10 ]

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: default avatarPetteri Aimonen <jpa@git.mail.kapsi.fi>
Signed-off-by: default avatarBorislav 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: default avatarSasha Levin <sashal@kernel.org>
parent d2bfb9eb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment