Re: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/23/2017 12:57 PM, Yu-cheng Yu wrote:
> On Mon, Jan 23, 2017 at 09:23:06AM -0800, Dave Hansen wrote:
>> On 01/23/2017 08:55 AM, Yu-cheng Yu wrote:
>>>> The best fix here would be not to paper over the issue in the copy
>>>> function but find where it got clobbered, or where some initialization
>>>> code failed to set it.
>>>
>>> Someone else reported different issues from the same bug and a different
>>> patch was just tested OK this morning.  I think that adding xfeatures bits
>>> to xcomp_bv should have been done in fpstate_init().
>>
>> Right.  So where did it get cleared out?
> 
> It is not set until a task triggers XSAVES.  We did not set it in fpstate_init()
> because there is no valid data at the time.

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?


--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux