Re: [PATCH 29/29] x86/fpu: Defer FPU state load until return to userspace

From: Sebastian Andrzej Siewior
Date: Mon Dec 10 2018 - 09:42:05 EST


On 2018-11-28 23:20:35 [+0100], To linux-kernel@xxxxxxxxxxxxxxx wrote:
> --- a/arch/x86/kernel/fpu/signal.c
> +++ b/arch/x86/kernel/fpu/signal.c
> @@ -228,13 +228,12 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
> struct task_struct *tsk = current;
> struct fpu *fpu = &tsk->thread.fpu;
> int state_size = fpu_kernel_xstate_size;
> - union fpregs_state *state;
> - void *tmp;
> struct user_i387_ia32_struct env;
> struct user_i387_ia32_struct *envp = NULL;
> int ret = 0;
> u64 xfeatures = 0;
> int fx_only = 0;
> + int err;
>
â
> } else if (use_fxsr()) {
> - ret = __copy_from_user(&state->fxsave, buf_fx, state_size);
> - if (ret)
> + ret = __copy_from_user(&fpu->state.fxsave, buf_fx, state_size);
> + if (ret) {
> + err = -EFAULT;
> goto err_out;
> + }

After reworking the series after addressing the comments for 08/29 I
noticed that `err' should have been `ret'.

Sebastian