linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Dmitry V. Levin" <ldv@strace.io>
Cc: Eugene Syromyatnikov <evgsyr@gmail.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Renzo Davoli <renzo@cs.unibo.it>,
	Davide Berardi <berardi.dav@gmail.com>,
	strace-devel@lists.strace.io, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org
Subject: Re: [PATCH 5/6] ptrace: introduce PTRACE_SET_SYSCALL_INFO request
Date: Thu, 9 Jan 2025 16:21:39 +0100	[thread overview]
Message-ID: <20250109152138.GE26424@redhat.com> (raw)
In-Reply-To: <20250107230456.GE30633@strace.io>

On 01/08, Dmitry V. Levin wrote:
>
> +ptrace_set_syscall_info_entry(struct task_struct *child, struct pt_regs *regs,
> +			      struct ptrace_syscall_info *info)
> +{
...
> +	syscall_set_nr(child, regs, nr);
> +	syscall_set_arguments(child, regs, args);
> +	if (nr == -1) {
> +		/*
> +		 * When the syscall number is set to -1, the syscall will be
> +		 * skipped.  In this case also set the syscall return value to
> +		 * -ENOSYS, otherwise on some architectures the corresponding
> +		 * struct pt_regs field will remain unchanged.
> +		 *
> +		 * Note that on some architectures syscall_set_return_value()
> +		 * modifies one of the struct pt_regs fields also modified by
> +		 * syscall_set_arguments(), so the former should be called
> +		 * after the latter.
> +		 */
> +		syscall_set_return_value(child, regs, -ENOSYS, 0);
> +	}

This doesn't look nice to me...

We don't need this syscall_set_return_value(ENOSYS) on x86, right?

So perhaps we should move this "if (nr == -1) code  into
syscall_set_nr/syscall_set_arguments on those "some architectures" which
actually need it ?

Oleg.


  parent reply	other threads:[~2025-01-09 15:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250107230153.GA30560@strace.io>
2025-01-07 23:04 ` [PATCH 5/6] ptrace: introduce PTRACE_SET_SYSCALL_INFO request Dmitry V. Levin
2025-01-09  1:37   ` kernel test robot
2025-01-09  2:21   ` kernel test robot
2025-01-09 14:03   ` kernel test robot
2025-01-09 15:17   ` Eugene Syromiatnikov
2025-01-09 15:21   ` Oleg Nesterov [this message]
2025-01-11 11:49     ` Dmitry V. Levin

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=20250109152138.GE26424@redhat.com \
    --to=oleg@redhat.com \
    --cc=berardi.dav@gmail.com \
    --cc=evgsyr@gmail.com \
    --cc=ldv@strace.io \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=renzo@cs.unibo.it \
    --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;
as well as URLs for NNTP newsgroup(s).