Re: [PATCH v2] x86/fpu: Allow PKRU to be (once again) written by ptrace.

From: Dave Hansen
Date: Fri Aug 05 2022 - 13:24:08 EST


On 8/3/22 20:16, Kyle Huey wrote:
> When management of the PKRU register was moved away from XSTATE, emulation
> of PKRU's existence in XSTATE was added for APIs that read XSTATE, but not
> for APIs that write XSTATE. This can be seen by running gdb and executing
> `p $pkru`, `set $pkru = 42`, and `p $pkru`. On affected kernels (5.14+) the
> write to the PKRU register (which gdb performs through ptrace) is ignored.

Do you happen to have a reproducer for this sitting around? I'd love to
get an addition to the pkeys selftest/ in place to make sure we don't
break this again. PKRU is a very special snowflake.