Re: [PATCH v2 8/8] x86/fpu/xstate: Restore supervisor xstates for __fpu__restore_sig()

From: Yu-cheng Yu
Date: Fri Feb 28 2020 - 17:14:19 EST


On Fri, 2020-02-28 at 22:47 +0100, Borislav Petkov wrote:
> On Fri, Feb 28, 2020 at 01:22:39PM -0800, Yu-cheng Yu wrote:
> > The code is for sigreturn only. Because of lazy-restore,
> > copy_xregs_to_kernel() does not happen all the time.
>
> What does "not all the time" mean? You need to quantify this more
> precisely.

If the XSAVES buffer already has current data (i.e. TIF_NEED_FPU_LOAD is
set), then skip copy_xregs_to_kernel(). This happens when the task was
context-switched out and has not returned to user-mode.