Re: [PATCH v5 12/13] x86/xsaves: Fix fpstate_init() for XSAVES

From: Dave Hansen
Date: Mon May 09 2016 - 19:41:36 EST


On 05/09/2016 01:46 PM, Yu-cheng Yu wrote:
> When XSAVES is used, xsave.header.xcomp_bv[63] must be set.

So, that's not strictly correct. XSAVES can write to a completely empty
(0'd) memory buffer. It's only XRSTORS that _needs_ bit 63 set. The
instruction reference is pretty clear on this point.

Oh, and if you decided to do this for some reason, please have mercy and
go make a macro for 1<<63.

Also, I don't think the kernel ever checks for this bit. So are we
really calling XRSTORS on otherwise uninitialized xsave buffers?