Re: x86/fpu/xsave: protection key test failures

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

 




On 5/25/21 7:36 PM, Andy Lutomirski wrote:
> On 5/25/21 2:37 PM, Babu Moger wrote:
> 
>> Investigation so far.
>> 1. The test fails on AMD(Milan) systems. Test appears to pass on Intel
>> systems. Tested on old Intel system available here.
> 
> Ten cents says that you have discovered that AMD returns a synthesized
> value for XINUSE[PKRU] and that write_pkru() is buggy.
> 
> Any volunteers to fix the if (!pk) case in write_pkru() and see if the
> problem goes away?  (Or at least to print something for the if (!pk)
> case and seee if it gets printed?)

I inserted this patch to test this path.


diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index b1099f2d9800..a0bca917f864 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -151,6 +160,8 @@ static inline void write_pkru(u32 pkru)
        fpregs_lock();
        if (pk)
                pk->pkru = pkru;
+       else
+               printk_once("%s read_pkru 0x%x\n",__FUNCTION__, read_pkru());
        __write_pkru(pkru);
        fpregs_unlock();
 }


Yes. The pk value is sometimes NULL and the value in the pkru register is
0 at that time. Here is the dmesg output.

[    1.700889] write_pkru read_pkru 0x0



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux