On Sat, Mar 28, 2020 at 09:43:03AM -0700, Yu-cheng Yu wrote: > The function sanitize_restored_xstate() sanitizes user xstates of an XSAVE > buffer by setting the buffer's header->xfeatures to the input 'xfeatures',
It doesn't set them to the input xfeatures. I see a "&=" there. > effectively resetting features not in 'xfeatures' 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 'xfeatures_from_user'. > - In __fpu__restore_sig(), rename 'xfeatures' to 'user_xfeatures'. > > v3: > - Change xfeatures_user to user_xfeatures. > > Signed-off-by: Yu-cheng Yu <yu-cheng...@intel.com> > Reviewed-by: Dave Hansen <dave.han...@linux.intel.com> > --- > arch/x86/kernel/fpu/signal.c | 37 +++++++++++++++++++++++------------- > 1 file changed, 24 insertions(+), 13 deletions(-) > > diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c > index cd6eafba12da..d09d72334a12 100644 > --- a/arch/x86/kernel/fpu/signal.c > +++ b/arch/x86/kernel/fpu/signal.c > @@ -211,9 +211,9 @@ int copy_fpstate_to_sigframe(void __user *buf, void > __user *buf_fx, int size) > } > > static inline void > -sanitize_restored_xstate(union fpregs_state *state, > - struct user_i387_ia32_struct *ia32_env, > - u64 xfeatures, int fx_only) > +sanitize_restored_user_xstate(union fpregs_state *state, > + struct user_i387_ia32_struct *ia32_env, > + u64 xfeatures_from_user, int fx_only) Name those user_xfeatures too. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette