Thread (17 messages) 17 messages, 3 authors, 2018-11-30

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

From: Oleg Nesterov <oleg@redhat.com>
Date: 2018-11-28 14:29:36
Also in: lkml

On 11/28, Oleg Nesterov wrote:
On 11/28, Dmitry V. Levin wrote:
quoted
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help