diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2023-04-18 15:50:26 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2023-04-18 23:22:28 +0000 |
commit | 617a11eab6337693eae9d160453adf1943ab6a37 (patch) | |
tree | 13bc325088ac9f1b62c66243d05d27c748de149f /sbin/comcontrol | |
parent | 93ca6ff2958cace3b7b883ed797ea6539881a6a2 (diff) | |
download | src-617a11eab6337693eae9d160453adf1943ab6a37.tar.gz src-617a11eab6337693eae9d160453adf1943ab6a37.zip |
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
Diffstat (limited to 'sbin/comcontrol')
0 files changed, 0 insertions, 0 deletions