]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/x86/xstate: Introduce signal ABI test
authorChang S. Bae <chang.seok.bae@intel.com>
Wed, 26 Feb 2025 01:07:26 +0000 (17:07 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 26 Feb 2025 12:05:29 +0000 (13:05 +0100)
commite075d9fa16b3681b8a375cb47f4b5a1901e93530
tree99a136a0cb39f185282d88a0792822b9b33983cf
parent7cb2fbe41949caa35ef1805323b8fc011fac2537
selftests/x86/xstate: Introduce signal ABI test

With the refactored test cases, another xstate exposure to userspace is
through signal delivery. While amx.c includes signal-related scenarios,
its primary focus is on xstate permission management, which is largely
specific to dynamic states.

The remaining gap is testing xstate preservation and restoration across
signal delivery. The kernel defines an ABI for presenting xstate in the
signal frame, closely resembling the hardware XSAVE format, where xstate
modification is also possible.

Introduce a new test case to verify xstate preservation across signal
delivery and return, that is ensuring ABI compatibility by:

 - Loading xstate before raising a signal.

 - Verifying correct exposure in the signal frame

 - Modifying xstate in the signal frame before returning.

 - Checking the state restoration upon signal return.

Integrate this test into the AMX test suite as an initial usage site.

  Expected output:
  $ amx_64
  ...
  [RUN]   AMX Tile data: load xstate and raise SIGUSR1
  [OK]    'magic1' is valid
  [OK]    'xfeatures' in SW reserved area is valid
  [OK]    'xfeatures' in XSAVE header is valid
  [OK]    xstate delivery was successful
  [OK]    'magic2' is valid
  [RUN]   AMX Tile data: load new xstate from sighandler and check it after sigreturn
  [OK]    xstate was restored correctly

Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250226010731.2456-7-chang.seok.bae@intel.com
tools/testing/selftests/x86/amx.c
tools/testing/selftests/x86/xstate.c
tools/testing/selftests/x86/xstate.h