[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87a6njezz1.ffs@nanos.tec.linutronix.de>
Date: Mon, 21 Jun 2021 22:15:30 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Borislav Petkov <bp@...e.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Tony Luck <tony.luck@...el.com>,
Yu-cheng Yu <yu-cheng.yu@...el.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Kan Liang <kan.liang@...ux.intel.com>
Subject: Re: [patch V3 22/66] x86/fpu: Move fpu__write_begin() to regset
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
Powered by blists - more mailing lists