]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/x86: Consolidate redundant signal helper functions
authorChang S. Bae <chang.seok.bae@intel.com>
Wed, 26 Feb 2025 01:07:21 +0000 (17:07 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 26 Feb 2025 12:05:28 +0000 (13:05 +0100)
commitdbd6b649e7d5b66c7fa95a65d67b59cf5b45f0ac
treed2869469913beefa4d2cd5272bb5760727c900e7
parentac3144f91bb4ca6c7e12d321ce9cf13b1fcb4cf2
selftests/x86: Consolidate redundant signal helper functions

The x86 selftests frequently register and clean up signal handlers, but
the sethandler() and clearhandler() functions have been redundantly
copied across multiple .c files.

Move these functions to helpers.h to enable reuse across tests,
eliminating around 250 lines of duplicate code.

Converge the error handling by using ksft_exit_fail_msg(), which is
functionally equivalent with err() within the selftest framework.

This change is a prerequisite for the upcoming xstate selftest, which
requires signal handling for registering and cleaning up handlers.

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-2-chang.seok.bae@intel.com
18 files changed:
tools/testing/selftests/x86/amx.c
tools/testing/selftests/x86/corrupt_xstate_header.c
tools/testing/selftests/x86/entry_from_vm86.c
tools/testing/selftests/x86/fsgsbase.c
tools/testing/selftests/x86/helpers.h
tools/testing/selftests/x86/ioperm.c
tools/testing/selftests/x86/iopl.c
tools/testing/selftests/x86/ldt_gdt.c
tools/testing/selftests/x86/mov_ss_trap.c
tools/testing/selftests/x86/ptrace_syscall.c
tools/testing/selftests/x86/sigaltstack.c
tools/testing/selftests/x86/sigreturn.c
tools/testing/selftests/x86/single_step_syscall.c
tools/testing/selftests/x86/syscall_arg_fault.c
tools/testing/selftests/x86/syscall_nt.c
tools/testing/selftests/x86/sysret_rip.c
tools/testing/selftests/x86/test_vsyscall.c
tools/testing/selftests/x86/unwind_vdso.c