[PATCH v4 2/2] selftests/ptrace: add a test case for PTRACE_SET_SYSCALL_INFO syscall skipping
Dmitry V. Levin
ldv at strace.io
Wed Jul 8 09:57:08 UTC 2026
On Wed, Jul 08, 2026 at 11:06:55AM +0200, Renzo Davoli wrote:
> Check whether PTRACE_SET_SYSCALL_INFO syscall skipping semantics implemented in the
> kernel matches userspace expectations.
[...]
> + ASSERT_LT(ptrace_stop, 4) {
> + LOG_KILL_TRACEE("ptrace stop overflow");
> + }
This assertion is redundant given that ...
> + const unsigned int expected_nr[] = {
> + __NR_getpid,
> + __NR_getpid,
> + __NR_getpid,
> + __NR_exit_group
> + };
> +
> + ASSERT_LT(ptrace_stop, ARRAY_SIZE(expected_nr)) {
> + LOG_KILL_TRACEE("ptrace stop overflow");
> + }
... there is a more reliable assertion here instead.
> + ASSERT_EQ(info.seccomp.nr, expected_nr[ptrace_stop]) {
> + LOG_KILL_TRACEE("syscall nr mismatch");
> + }
> + switch (ptrace_stop) {
> + case 0:
> + case 3:
> + break;
These two cases don't really do anything, feel free to drop them if you
like, it's a matter of style preferences.
--
ldv
More information about the Strace-devel
mailing list