public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@strace.io>
To: Oleg Nesterov <oleg@redhat.com>
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
Subject: Re: [PATCH 4/6] ptrace_get_syscall_info: factor out ptrace_get_syscall_info_op
Date: Thu, 9 Jan 2025 12:27:55 +0200	[thread overview]
Message-ID: <20250109102755.GA15384@strace.io> (raw)
In-Reply-To: <20250109100943.GA26424@redhat.com>

On Thu, Jan 09, 2025 at 11:09:44AM +0100, Oleg Nesterov wrote:
> On 01/08, Dmitry V. Levin wrote:
> >
> > +static int
> > +ptrace_get_syscall_info(struct task_struct *child, unsigned long user_size,
> > +			void __user *datavp)
> > +{
> > +	struct pt_regs *regs = task_pt_regs(child);
> > +	struct ptrace_syscall_info info = {
> > +		.op = ptrace_get_syscall_info_op(child),
> > +		.arch = syscall_get_arch(child),
> > +		.instruction_pointer = instruction_pointer(regs),
> > +		.stack_pointer = user_stack_pointer(regs),
> > +	};
> > +	unsigned long actual_size = offsetof(struct ptrace_syscall_info, entry);
> > +	unsigned long write_size;
> > +
> > +	switch (info.op) {
> > +	case PTRACE_SYSCALL_INFO_ENTRY:
> > +		actual_size = ptrace_get_syscall_info_entry(child, regs, &info);
> > +		break;
> > +	case PTRACE_SYSCALL_INFO_EXIT:
> > +		actual_size = ptrace_get_syscall_info_exit(child, regs, &info);
> > +		break;
> > +	case PTRACE_SYSCALL_INFO_SECCOMP:
> > +		actual_size = ptrace_get_syscall_info_seccomp(child, regs, &info);
> >  		break;
> 
> OK... but unless I misread this patch, all 3 ptrace_get_syscall_info_xxx()
> helpers will do the pointless info->op = PTRACE_SYSCALL_INFO_XXX ?

Thanks, your analysis is correct, with this change those assignments
become redundant, I'll remove them in the next iteration of this patch.


-- 
ldv

  reply	other threads:[~2025-01-09 10:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 23:01 [PATCH 0/6] ptrace: introduce PTRACE_SET_SYSCALL_INFO API Dmitry V. Levin
2025-01-07 23:04 ` [PATCH 1/6] Revert "arch: remove unused function syscall_set_arguments()" Dmitry V. Levin
2025-01-07 23:04 ` [PATCH 2/6] syscall.h: add syscall_set_arguments() on remaining HAVE_ARCH_TRACEHOOK arches Dmitry V. Levin
2025-01-09 12:04   ` Oleg Nesterov
2025-01-09 12:11     ` Dmitry V. Levin
2025-01-07 23:04 ` [PATCH 3/6] syscall.h: introduce syscall_set_nr() Dmitry V. Levin
2025-01-10  7:37   ` Sven Schnelle
2025-01-11  1:16     ` Dmitry V. Levin
2025-01-07 23:04 ` [PATCH 4/6] ptrace_get_syscall_info: factor out ptrace_get_syscall_info_op Dmitry V. Levin
2025-01-09 10:09   ` Oleg Nesterov
2025-01-09 10:27     ` Dmitry V. Levin [this message]
2025-01-09 10:41   ` Oleg Nesterov
2025-01-09 11:14     ` Dmitry V. Levin
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
2025-01-11 11:49     ` Dmitry V. Levin
2025-01-07 23:05 ` [PATCH 6/6] selftests/ptrace: add a test case for PTRACE_SET_SYSCALL_INFO Dmitry V. Levin
2025-01-10  3:15 ` [PATCH 0/6] ptrace: introduce PTRACE_SET_SYSCALL_INFO API H. Peter Anvin

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=20250109102755.GA15384@strace.io \
    --to=ldv@strace.io \
    --cc=berardi.dav@gmail.com \
    --cc=evgsyr@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --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