Syscall User Dispatch is unavailable on architectures without generic
syscall entry. Such architectures return -EINVAL for otherwise valid SUD
ptrace requests.
The test currently treats this as a failure even though the feature is
not supported. Probe SUD with a valid disabled configuration before
creating the tracee and skip the test when the kernel returns EINVAL.
Other errors remain test failures, and kernels that support SUD continue
to exercise the ptrace GET/SET requests.
Fixes: 8c8fa605f7b8 ("selftest, ptrace: Add selftest for syscall user dispatch
config api")
Reported-by: Rama Krishna Katta <[email protected]>
Signed-off-by: Christian Loehle <[email protected]>
---
tools/testing/selftests/ptrace/get_set_sud.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/testing/selftests/ptrace/get_set_sud.c
b/tools/testing/selftests/ptrace/get_set_sud.c
index 2e619c7599bb..395674f85964 100644
--- a/tools/testing/selftests/ptrace/get_set_sud.c
+++ b/tools/testing/selftests/ptrace/get_set_sud.c
@@ -22,6 +22,14 @@ TEST(get_set_sud)
int ret = 0;
int status;
+ ret = prctl(PR_SET_SYSCALL_USER_DISPATCH, PR_SYS_DISPATCH_OFF,
+ 0UL, 0UL, 0UL);
+ if (ret == -1 && errno == EINVAL)
+ SKIP(return, "Syscall User Dispatch is not supported");
+ ASSERT_EQ(0, ret) {
+ TH_LOG("PR_SET_SYSCALL_USER_DISPATCH: %m");
+ }
+
child = fork();
ASSERT_GE(child, 0);
if (child == 0) {
--
2.34.1