Hi Aruna,

Commit ae6012d72fa6 "x86/pkeys: Ensure updated PKRU value is XRSTOR'd"
seems to be broken on some Zhaoxin/VIA processors.  Specifically:

On Thu, 2025-04-24 at 16:24 +0800, Larry Wei wrote:
> Thanks for your replying, the `Probe URL` of my laptop: 
> https://linux-hardware.org/?probe=58facb533d , and `cpuinfo` is:
> 
> larry@zx2:~/Downloads$ sudo cat /proc/cpuinfo
> processor    : 0
> vendor_id    : CentaurHauls
> cpu family    : 7
> model        : 59
> model name    : ZHAOXIN KaiXian KX-6000G/4@3.0GHz
[...]
> flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca 
> cmov pat pse36 clflush acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx 
> pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl nonstop_tsc 
> cpuid aperfmperf pni pclmulqdq monitor vmx smx est tm2 ssse3 cx16 xtpr 
> pcid sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes xsave avx f16c 
> rdrand rng rng_en ace ace_en ace2 phe phe_en pmm pmm_en lahf_lm abm 
> 3dnowprefetch ibrs ibpb tpr_shadow ept vpid fsgsbase tsc_adjust bmi1 
> smep bmi2 invpcid rdseed adx smap sha_ni xsaveopt dtherm hwp 
> hwp_act_window hwp_epp hwp_pkg_req vnmi umip pku ospke rdpid 
> arch_capabilities
> vmx flags    : vnmi invvpid ept_x_only ept_1gb tsc_offset vtpr mtf ept 
> vpid unrestricted_guest ple
[...]

Notice that this has the PKU and OSPKE features set, but *not* XGETBV1.
Which means that xfeatures_in_use() should not be called (and will cause
a #GP exception).

(The full bug report log for this is at
<https://bugs.debian.org/1103397>.)

Is there some fallback that could be used in case XGETBV1 is not
available?  Or do we need a dependency X86_FEATURE_PKU ->
X86_FEATURE_XGETBV1 in arch/x86/kernel/cpu/cpuid-deps.c, so that we
disable protection keys in this CPU?
> 
> 

Ben.

-- 
Ben Hutchings
Who are all these weirdos? - David Bowie, on joining IRC

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to