x86/fpu/xstate: Fix last_good_offset in setup_xstate_features()
authorYu-cheng Yu <yu-cheng.yu@intel.com>
Thu, 9 Jan 2020 21:14:50 +0000 (13:14 -0800)
committerBorislav Petkov <bp@suse.de>
Tue, 11 Feb 2020 18:54:04 +0000 (19:54 +0100)
commitc12e13dcd814023a903399ec5ac2e7082d664b8b
tree82de601013579408aeb9bc2cc8021188e2188c30
parentbb6d3fb354c5ee8d6bde2d576eb7220ea09862b9
x86/fpu/xstate: Fix last_good_offset in setup_xstate_features()

The function setup_xstate_features() uses CPUID to find each xfeature's
standard-format offset and size.  Since XSAVES always uses the compacted
format, supervisor xstates are *NEVER* in the standard-format and their
offsets are left as -1's.  However, they are still being tracked as
last_good_offset.

Fix it by tracking only user xstate offsets.

 [ bp: Use xfeature_is_supervisor() and save an indentation level. Drop
   now unused xfeature_is_user(). ]

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/20200109211452.27369-2-yu-cheng.yu@intel.com
arch/x86/kernel/fpu/xstate.c