Re: [PATCH 7/7] selftests/x86: Add tests for signal frame FPU portability

From: Borislav Petkov

Date: Thu Sep 24 2026 - 14:52:42 EST


On Thu, Sep 24, 2026 at 04:16:03AM +0000, Andrei Vagin wrote:
> Add a new selftest tools/testing/selftests/x86/sigframe_fpu_portability.c
> to verify signal frame portability and consistency when the xstate size
> is shrunk:
>
> - test_valid_shrunk_xstate_size: Verifies that the kernel correctly
> restores the xstate context from a signal frame where xstate_size has
> been manually shrunk to only cover active features, as long as the
> FP_XSTATE_MAGIC2 marker is correctly placed. This simulates migrating
> a process created on a host with fewer xstate features to a host with
> more features.
>
> - test_invalid_shrunk_xstate_size: Verifies that the kernel rejects
> (via SIGSEGV) a signal frame where xstate_size is smaller than required
> by the enabled features in the xfeatures mask.
>
> Reviewed-by: Alexander Mikhalitsyn <alexander@xxxxxxxxxxxxx>
> Reviewed-by: Chang S. Bae <chang.seok.bae@xxxxxxxxx>
> Signed-off-by: Andrei Vagin <avagin@xxxxxxxxxx>
> ---
> tools/testing/selftests/x86/Makefile | 5 +-
> .../selftests/x86/sigframe_fpu_portability.c | 246 ++++++++++++++++++
> tools/testing/selftests/x86/xstate.c | 12 -
> tools/testing/selftests/x86/xstate.h | 20 ++
> 4 files changed, 270 insertions(+), 13 deletions(-)
> create mode 100644 tools/testing/selftests/x86/sigframe_fpu_portability.c

Sashiko has a comment which sounds valid to me but I haven't looked at the
surrounding code:

https://sashiko.dev/#/patchset/20260924041604.3209659-1-avagin%40google.com

--
Regards/Gruss,
Boris.

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