lkml.org 
[lkml]   [2017]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area
From
Date
On 01/23/2017 01:16 PM, Yu-cheng Yu wrote:
> On Mon, Jan 23, 2017 at 01:10:20PM -0800, Dave Hansen wrote:
>> The code is:
>>
>>> void fpstate_init(union fpregs_state *state)
>>> {
>>> if (!static_cpu_has(X86_FEATURE_FPU)) {
>>> fpstate_init_soft(&state->soft);
>>> return;
>>> }
>>>
>>> memset(state, 0, fpu_kernel_xstate_size);
>>>
>>> /*
>>> * XRSTORS requires that this bit is set in xcomp_bv, or
>>> * it will #GP. Make sure it is replaced after the memset().
>>> */
>>> if (static_cpu_has(X86_FEATURE_XSAVES))
>>> state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT;
>>
>> That seems to set it unconditionally. What am I missing?
>
> The fix I am proposing is...
>
> state->xsave.header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT |
> xfeatures_mask;

Ahh, that makes sense. That does indeed look like a bug in fpstate_init().

\
 
 \ /
  Last update: 2017-01-23 22:29    [W:0.138 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site