Re: [PATCH 0/3]: x86, fpu: unlazy_fpu fixes/cleanups

From: Dave Hansen
Date: Thu Jan 29 2015 - 18:26:14 EST


On 01/29/2015 01:56 PM, Oleg Nesterov wrote:
> --- x/arch/x86/kernel/traps.c
> +++ x/arch/x86/kernel/traps.c
> @@ -313,7 +313,7 @@ dotraplinkage void do_bounds(struct pt_r
> * It is not directly accessible, though, so we need to
> * do an xsave and then pull it out of the xsave buffer.
> */
> - fpu_save_init(&tsk->thread.fpu);
> + unlazy_fpu(tsk);
> xsave_buf = &(tsk->thread.fpu.state->xsave);
...
> bndcsr = get_xsave_addr(xsave_buf, XSTATE_BNDCSR);

Hmm, if the the thread was not using the FPU, and this fails to save
anything in to the xsave_buf, what will bndcsr point to? It _looks_ to
me like it will just point to uninitialized data since the xsave never
happened.

Fenghua, shouldn't get_xsave_addr() be checking the xstate bit against
the xsave->xstate_bv?
--
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/