Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [patch V3 22/66] x86/fpu: Move fpu__write_begin() to regset | Date | Mon, 21 Jun 2021 22:15:30 +0200 |
| |
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
| |