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

From: Borislav Petkov
Date: Tue May 25 2021 - 13:27:24 EST


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.

> The dis-advantage of on-demand is that there is no buffer release mechanism --
> the buffer lives as long as the task lives. Though, per previous conversation,
> a future kernel could easily implement a buffer re-claim mechanism
> behind the scenes
> since the kernel is empowered to re-arm XFD for whatever reason it wants...

Why is buffer release even needed? 1) sounds like a simple and clean thing to
do.

> 2. Synchronous allocation. Any task in the process that has AMX permission can
> make a 2nd system call to request that the kernel synchronously allocate the
> 8KB buffer for that task. *

That doesn't sound as clean. More like unneeded work on the side of
userspace programmer which she/he can save her-/himself from.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette