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.
Obtained from: Juniper Networks, Inc.