Re: [PATCH v5 15/28] x86/arch_prctl: Create ARCH_GET_XSTATE/ARCH_PUT_XSTATE

From: Dave Hansen
Date: Tue May 25 2021 - 13:34:08 EST

On 5/25/21 10:27 AM, Borislav Petkov wrote:
> On Mon, May 24, 2021 at 07:10:57PM -0400, Len Brown wrote:
>> 1. CPUID has AMX
>> 2. XCR0 has AMX
>> 3. Linux permission has been requested and granted to this process
> Actually, you want *only* 3 as 1 is a bad idea - we're in this mess
> because userspace does feature detection on its own even when kernel
> support is needed.
> When Linux grants the permission, 1 and 2 should be implicitly given.

We did this for pkeys. Essentially, we said, "don't bother with
CPUID.OSPKE and XCRO[PKRU] checking". Just call alloc_pkey() and we'll
do the checking for you. One stop shopping.

So far, it's worked well.