OSDN Git Service

x86/fpu/xstate: Update sanitize_restored_xstate() for supervisor xstates
authorYu-cheng Yu <yu-cheng.yu@intel.com>
Tue, 12 May 2020 14:54:40 +0000 (07:54 -0700)
committerBorislav Petkov <bp@suse.de>
Wed, 13 May 2020 18:11:08 +0000 (20:11 +0200)
commit5d6b6a6f9b5ce7ac42273efd75d61ec63b463c18
tree25767b4d8de0c5adfcf7d5f4504b14d760b1839a
parentb860eb8dce5906b14e3a7f3c771e0b3d6ef61b94
x86/fpu/xstate: Update sanitize_restored_xstate() for supervisor xstates

The function sanitize_restored_xstate() sanitizes user xstates of an XSAVE
buffer by clearing bits not in the input 'xfeatures' from the buffer's
header->xfeatures, effectively resetting those features back to the init
state.

When supervisor xstates are introduced, it is necessary to make sure only
user xstates are sanitized.  Ensure supervisor bits in header->xfeatures
stay set and supervisor states are not modified.

To make names clear, also:

- Rename the function to sanitize_restored_user_xstate().
- Rename input parameter 'xfeatures' to 'user_xfeatures'.
- In __fpu__restore_sig(), rename 'xfeatures' to 'user_xfeatures'.

Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lkml.kernel.org/r/20200512145444.15483-7-yu-cheng.yu@intel.com
arch/x86/kernel/fpu/signal.c