summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2016-11-07 16:26:35 -0500
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-04-04 09:17:15 -0400
commit631b7abacd02b88f4b0795c08b54ad4fc3e7c7c0 (patch)
treeb014cc81ce32ca7e3fb05bf5d90d35737fa56cc2 /fs
parent79a3aaa7b82e3106be97842dedfd8429248896e6 (diff)
ptrace: Remove maxargs from task_current_syscall()
task_current_syscall() has a single user that passes in 6 for maxargs, which is the maximum arguments that can be used to get system calls from syscall_get_arguments(). Instead of passing in a number of arguments to grab, just get 6 arguments. The args argument even specifies that it's an array of 6 items. This will also allow changing syscall_get_arguments() to not get a variable number of arguments, but always grab 6. Linus also suggested not passing in a bunch of arguments to task_current_syscall() but to instead pass in a pointer to a structure, and just fill the structure. struct seccomp_data has almost all the parameters that is needed except for the stack pointer (sp). As seccomp_data is part of uapi, and I'm afraid to change it, a new structure was created "syscall_info", which includes seccomp_data and adds the "sp" field. Link: http://lkml.kernel.org/r/20161107213233.466776454@goodmis.org Cc: Andy Lutomirski <luto@kernel.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Kees Cook <keescook@chromium.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/base.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index ddef482f1334..6a803a0b75df 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -616,24 +616,25 @@ static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns,
616static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns, 616static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
617 struct pid *pid, struct task_struct *task) 617 struct pid *pid, struct task_struct *task)
618{ 618{
619 long nr; 619 struct syscall_info info;
620 unsigned long args[6], sp, pc; 620 u64 *args = &info.data.args[0];
621 int res; 621 int res;
622 622
623 res = lock_trace(task); 623 res = lock_trace(task);
624 if (res) 624 if (res)
625 return res; 625 return res;
626 626
627 if (task_current_syscall(task, &nr, args, 6, &sp, &pc)) 627 if (task_current_syscall(task, &info))
628 seq_puts(m, "running\n"); 628 seq_puts(m, "running\n");
629 else if (nr < 0) 629 else if (info.data.nr < 0)
630 seq_printf(m, "%ld 0x%lx 0x%lx\n", nr, sp, pc); 630 seq_printf(m, "%d 0x%llx 0x%llx\n",
631 info.data.nr, info.sp, info.data.instruction_pointer);
631 else 632 else
632 seq_printf(m, 633 seq_printf(m,
633 "%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n", 634 "%d 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx 0x%llx\n",
634 nr, 635 info.data.nr,
635 args[0], args[1], args[2], args[3], args[4], args[5], 636 args[0], args[1], args[2], args[3], args[4], args[5],
636 sp, pc); 637 info.sp, info.data.instruction_pointer);
637 unlock_trace(task); 638 unlock_trace(task);
638 639
639 return 0; 640 return 0;