lkml.org 
[lkml]   [2021]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch V3 22/66] x86/fpu: Move fpu__write_begin() to regset
Date
On Mon, Jun 21 2021 at 17:30, Borislav Petkov wrote:
>> @@ -89,7 +108,7 @@ int xfpregs_set(struct task_struct *targ
>> if (newstate.mxcsr & ~mxcsr_feature_mask)
>> ret = -EINVAL;
> ^^^^^^^^^^^^^^
>
> Don't forget to fix that thing, btw.

Fixed localy at the right spot already.

>> - fpu__prepare_write(fpu);
>> + fpu_force_restore(fpu);
>>
>> /* Copy the state */
>> memcpy(&fpu->state.fxsave, &newstate, sizeof(newstate));
>> @@ -147,7 +166,7 @@ int xstateregs_set(struct task_struct *t
>> }
>> }
>>
>> - fpu__prepare_write(fpu);
>> + fpu_force_restore(fpu);
>> ret = copy_kernel_to_xstate(&fpu->state.xsave, kbuf ?: tmpbuf);
>
> Ok, this here:
>
> fpu_force_restore() will unconditionally invalidate the fpregs but the
> following copy_kernel_to_xstate() call can return -EINVAL when the
> xstate header validation fails or mxcsr has reserved bits set so we will
> not have copied anything to the target thread.

Then the task has to restore FPU on the way to user space. Not a big
deal, it's traced - so what?

Thanks,

tglx

\
 
 \ /
  Last update: 2021-06-21 22:16    [W:0.503 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site