diff options
author | Fenghua Yu <fenghua.yu@intel.com> | 2022-02-08 02:02:49 +0300 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2022-02-15 13:31:43 +0300 |
commit | dc7507ddce593cbd9c93330024a5658db6f8ef73 (patch) | |
tree | 7852f5000047f81e38d5ae12033e4d1c801bb368 /include/linux/sched.h | |
parent | 701fac40384f07197b106136012804c3cae0b3de (diff) | |
download | linux-dc7507ddce593cbd9c93330024a5658db6f8ef73.tar.xz |
x86/fpu: Clear PASID when copying fpstate
The kernel must allocate a Process Address Space ID (PASID) on behalf of
each process which will use ENQCMD and program it into the new MSR to
communicate the process identity to platform hardware. ENQCMD uses the
PASID stored in this MSR to tag requests from this process.
The PASID state must be cleared on fork() since fork creates a
new address space.
For clone(), it would be functionally OK to copy the PASID. However,
clearing it is _also_ functionally OK since any PASID use will trigger
the #GP handler to populate the MSR.
Copying the PASID state has two main downsides:
* It requires differentiating fork() and clone() in the code,
both in the FPU code and keeping tsk->pasid_activated consistent.
* It guarantees that the PASID is out of its init state, which
incurs small but non-zero cost on every XSAVE/XRSTOR.
The main downside of clearing the PASID at fpstate copy is the future,
one-time #GP for the thread.
Use the simplest approach: clear the PASID state both on clone() and
fork(). Rely on the #GP handler for MSR population in children.
Also, just clear the PASID bit from xfeatures if XSAVE is supported.
This will have no effect on systems that do not have PASID support. It
is virtually zero overhead because 'dst_fpu' was just written and
the whole thing is cache hot.
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20220207230254.3342514-7-fenghua.yu@intel.com
Diffstat (limited to 'include/linux/sched.h')
0 files changed, 0 insertions, 0 deletions