freebsd-dev/sys/i386
Konstantin Belousov 617a11eab6 x86: initialize use_xsave once
The explanation from https://reviews.freebsd.org/D39637 by stevek:
The "use_xsave" variable is a global and that is only supposed to be
initialized early before scheduling gets started. However, with the way
the ifuncs for "fpusave" and "fpurestore" are implemented, the value
could be changed at runtime when scheduling is active if "use_xsave"
was set to 0 by the tunable. This leaves a window of opportunity where
"use_xsave" gets re-initialized to 1 and a context switch could occur
with a thread that was not set up to be able to use xsave functionality.
This can lead to an "privileged instruction fault".

The fix is to protect "use_xsave" from being initialized more than once.

Reported and reviewed by:	stevek
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D39660
2023-04-19 02:22:28 +03:00
..
acpica acpica: Merge ACPICA 20221020 2022-10-27 22:04:32 -04:00
bios i386: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 14:26:43 -07:00
conf rtsx: Add plug-and-play info 2023-04-13 11:12:50 -03:00
i386 x86: initialize use_xsave once 2023-04-19 02:22:28 +03:00
include amd64: fix PKRU and swapout interaction 2023-04-15 02:53:59 +03:00
linux linux(4): Regen for close_range syscall 2023-04-04 23:23:37 +03:00
pci i386: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 14:26:43 -07:00
Makefile Remove iBCS2, part2: general kernel 2018-12-19 21:57:58 +00:00