Skip to content

x86/pkeys: Remove unnecessary XGETBV1 dependency in signal frame exposition

Chang S. Bae lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/fpu: Refactor xfeature bitmask update code for sigframe XSAVEarch/x86/kernel/fpu/signal.c arch/x86/kernel/fpu/xstate.h+13 -100 replies
2/2x86/pkeys: Simplify PKRU update in signal framearch/x86/kernel/fpu/xstate.h+3 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] x86/pkeys: Remove unnecessary XGETBV1 dependency in signal frame exposition

Hi all,

This series removes an unnecessary dependency on XGETBV1 which was brought by commit

    ae6012d72fa6 ("x86/pkeys: Ensure updated PKRU value is XRSTOR'd").

Currently, the PKRU exposure logic overwrites xregs_state->header ->xfeatures in the signal frame, seemingly to emulate XSAVE behavior:
combining the requested feature bitmap with a processor-tracked status bitmap derived from XGETBV(1).

A previous posting [1] attempted to handle the case where XGETBV(1) is disabled or unexposed. However, that approach assumed this dependency was necessary and further modified the logic to skip PKRU writes in such cases, which appears problematic.

Instead, the XSAVE-written value can be read directly from userspace memory, as is already done for legacy states [2]. Thus, tying PKRU exposure in the ABI to XGETBV1 is excessive. This series refactors reusable code into a helper and applies it to PKRU handling, fully eliminating the XGETBV1 dependency.

Thanks,
Chang

[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/x86/kernel/fpu/signal.c#n139

Chang S. Bae (2):
x86/fpu: Refactor xfeature bitmask update code for sigframe XSAVE x86/pkeys: Simplify PKRU update in signal frame

 arch/x86/kernel/fpu/signal.c | 11 +----------
 arch/x86/kernel/fpu/xstate.h | 21 +++++++++++++++------
 2 files changed, 16 insertions(+), 16 deletions(-)

base-commit: b36de8b904b8ff2095ece7af6b3cfff8c73c2fb1

Signature · 1 line
2.45.2