Re: x86/fpu/xsave: protection key test failures
From: Dave Hansen
Date: Tue May 25 2021 - 18:29:02 EST
On 5/25/21 3:22 PM, Dave Kleikamp wrote:
> On 5/25/21 5:18 PM, Dave Hansen wrote:
>> What values do PKRU and the shadow have when the test fails? Is PKRU 0?
>> Any idea how xfeatures&0x200 got clear?
>
> I did observe that PKRU is 0 right before the failure.
>
> Shouldn't this still be a valid value?
It's architecturall *valid* in the hardware for sure, but nothing in the
tests or the kernel should ever set PKRU=0. The selftest is noticing
that it ends up at a value that's entirely unexpected and properly
bugging out.
The reason I'm suspecting an XRSTOR is that the kernel always calls
XRSTOR(RFBM=-1)
setting all of the bits in the Requested Feature BitMap (RFBM). If
RFBM[X]=1 and XSTATE_BV[i]=0 (XSTATE_BV is 'xfeatures' in the traces),
then the state component is set to its initial configuration, which for
PKRU is 0.
That's why I'm asking how xfeatures&0x200 got clear.