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

From: Oleg Nesterov
Date: Wed Nov 28 2018 - 09:10:59 EST


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, but why do we need the temporary args[],
syscall_get_arguments(..., info->entry.args) should equally work?

Oleg.