aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/x86/syscall_arg_fault.c
diff options
context:
space:
mode:
authorChang S. Bae <[email protected]>2025-02-26 01:07:21 +0000
committerIngo Molnar <[email protected]>2025-02-26 12:05:28 +0000
commitdbd6b649e7d5b66c7fa95a65d67b59cf5b45f0ac (patch)
treed2869469913beefa4d2cd5272bb5760727c900e7 /tools/testing/selftests/x86/syscall_arg_fault.c
parentMerge tag 'v6.14-rc4' into x86/fpu, to pick up fixes and refresh the branch (diff)
downloadkernel-dbd6b649e7d5b66c7fa95a65d67b59cf5b45f0ac.tar.gz
kernel-dbd6b649e7d5b66c7fa95a65d67b59cf5b45f0ac.zip
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'tools/testing/selftests/x86/syscall_arg_fault.c')
-rw-r--r--tools/testing/selftests/x86/syscall_arg_fault.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/tools/testing/selftests/x86/syscall_arg_fault.c b/tools/testing/selftests/x86/syscall_arg_fault.c
index 48ab065a76f9..f67a2df335ba 100644
--- a/tools/testing/selftests/x86/syscall_arg_fault.c
+++ b/tools/testing/selftests/x86/syscall_arg_fault.c
@@ -17,18 +17,6 @@
#include "helpers.h"
-static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *),
- int flags)
-{
- struct sigaction sa;
- memset(&sa, 0, sizeof(sa));
- sa.sa_sigaction = handler;
- sa.sa_flags = SA_SIGINFO | flags;
- sigemptyset(&sa.sa_mask);
- if (sigaction(sig, &sa, 0))
- err(1, "sigaction");
-}
-
static sigjmp_buf jmpbuf;
static volatile sig_atomic_t n_errs;