Re: [PATCH v2 6/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO request
From: Dmitry V. Levin
Date: Wed Jan 15 2025 - 12:36:55 EST
On Wed, Jan 15, 2025 at 05:38:09PM +0100, Oleg Nesterov wrote:
[...]
> > + syscall_set_nr(child, regs, nr);
> > + /*
> > + * If the syscall number is set to -1, setting syscall arguments is not
> > + * just pointless, it would also clobber the syscall return value on
> > + * those architectures that share the same register both for the first
> > + * argument of syscall and its return value.
> > + */
> > + if (nr != -1)
> > + syscall_set_arguments(child, regs, args);
>
> Thanks, much better than I tried to suggest in my reply to V1.
>
> But may be
>
> if (syscall_get_nr() != -1)
> syscall_set_arguments(...);
>
> will look a bit more consistent?
I'm sorry, but I didn't follow. As we've just set the syscall number with
syscall_set_nr(), why would we want to call syscall_get_nr() right after
that to obtain the syscall number?
--
ldv