Re: [PATCH] x86/fpu: Load xsave pointer *after* initialization
From: Oleg Nesterov
Date: Thu Apr 16 2015 - 14:20:54 EST
On 04/16, Borislav Petkov wrote:
>
> Box exploded with the splat at the end because we do cache
> &target->thread.fpu.state->xsave into the local variable xsave but
> that pointer is NULL at that time and it gets initialized later, in
> init_fpu(), see
>
> e7f180dcd8ab ("x86/fpu: Change xstateregs_get()/set() to use
> ->xsave.i387 rather than ->fxsave")
OOPS! thanks a lot!!!
> --- a/arch/x86/kernel/i387.c
> +++ b/arch/x86/kernel/i387.c
> @@ -341,7 +341,7 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
> unsigned int pos, unsigned int count,
> void *kbuf, void __user *ubuf)
> {
> - struct xsave_struct *xsave = &target->thread.fpu.state->xsave;
> + struct xsave_struct *xsave;
> int ret;
>
> if (!cpu_has_xsave)
> @@ -351,6 +351,8 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
> if (ret)
> return ret;
>
> + xsave = &target->thread.fpu.state->xsave;
> +
Yes, but don't we need the same change in xstateregs_set() ?
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/