The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@strace.io>
To: Renzo Davoli <renzo@cs.unibo.it>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>, Shuah Khan <shuah@kernel.org>,
	Alexey Gladkov <legion@kernel.org>,
	Eugene Syromyatnikov <evgsyr@gmail.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Davide Berardi <berardi.dav@gmail.com>,
	strace-devel@lists.strace.io
Subject: Re: [PATCH v4 2/2] selftests/ptrace: add a test case for PTRACE_SET_SYSCALL_INFO syscall skipping
Date: Wed, 8 Jul 2026 12:57:08 +0300	[thread overview]
Message-ID: <20260708095708.GA29093@strace.io> (raw)
In-Reply-To: <20260708090655.38432-3-renzo@cs.unibo.it>

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

      reply	other threads:[~2026-07-08  9:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  9:06 [PATCH v4 0/2] PTRACE_SET_SYSCALL_INFO: add support for seccomp syscall skipping Renzo Davoli
2026-07-08  9:06 ` [PATCH v4 1/2] ptrace: add PTRACE_SET_SYSCALL_INFO syscall skipping support Renzo Davoli
2026-07-08 15:32   ` Dmitry V. Levin
2026-07-08 15:44     ` Oleg Nesterov
2026-07-08 22:09       ` Dmitry V. Levin
2026-07-09  6:07         ` Oleg Nesterov
2026-07-08  9:06 ` [PATCH v4 2/2] selftests/ptrace: add a test case for PTRACE_SET_SYSCALL_INFO syscall skipping Renzo Davoli
2026-07-08  9:57   ` Dmitry V. Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260708095708.GA29093@strace.io \
    --to=ldv@strace.io \
    --cc=akpm@linux-foundation.org \
    --cc=berardi.dav@gmail.com \
    --cc=evgsyr@gmail.com \
    --cc=legion@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=renzo@cs.unibo.it \
    --cc=shuah@kernel.org \
    --cc=strace-devel@lists.strace.io \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox