Re: [PATCH v4 2/2] ptrace: add PTRACE_GET_SYSCALL_INFO request

From: Oleg Nesterov
Date: Wed Nov 28 2018 - 09:29:36 EST


On 11/28, Oleg Nesterov wrote:
>
> On 11/28, Dmitry V. Levin wrote:
> >
> > +static unsigned long
> > +ptrace_get_syscall_info_entry(struct task_struct *child,
> > + struct ptrace_syscall_info *info)
> > +{
> > + struct pt_regs *regs = task_pt_regs(child);
> > + unsigned long args[ARRAY_SIZE(info->entry.args)];
> > + int i;
> > +
> > + info->op = PTRACE_SYSCALL_INFO_ENTRY;
> > + info->arch = syscall_get_arch(child);
> > + info->entry.nr = syscall_get_nr(child, regs);
> > + info->entry.instruction_pointer = instruction_pointer(regs);
> > + info->entry.stack_pointer = user_stack_pointer(regs);
> > + info->entry.frame_pointer = frame_pointer(regs);
> > + syscall_get_arguments(child, regs, 0, ARRAY_SIZE(args), args);
> > + for (i = 0; i < ARRAY_SIZE(args); i++)
> > + info->entry.args[i] = args[i];
>
> I must have missed something,

Yes ;) I didn't look at info->entry.args, it is __u64[6].

> but why do we need the temporary args[],
> syscall_get_arguments(..., info->entry.args) should equally work?
>
> Oleg.