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>
This commit is contained in:

committed by
Steven Rostedt (VMware)

parent
79a3aaa7b8
commit
631b7abacd
@@ -9,6 +9,13 @@
|
||||
#include <linux/bug.h> /* For BUG_ON. */
|
||||
#include <linux/pid_namespace.h> /* For task_active_pid_ns. */
|
||||
#include <uapi/linux/ptrace.h>
|
||||
#include <linux/seccomp.h>
|
||||
|
||||
/* Add sp to seccomp_data, as seccomp is user API, we don't want to modify it */
|
||||
struct syscall_info {
|
||||
__u64 sp;
|
||||
struct seccomp_data data;
|
||||
};
|
||||
|
||||
extern int ptrace_access_vm(struct task_struct *tsk, unsigned long addr,
|
||||
void *buf, int len, unsigned int gup_flags);
|
||||
@@ -407,9 +414,7 @@ static inline void user_single_step_report(struct pt_regs *regs)
|
||||
#define current_user_stack_pointer() user_stack_pointer(current_pt_regs())
|
||||
#endif
|
||||
|
||||
extern int task_current_syscall(struct task_struct *target, long *callno,
|
||||
unsigned long args[6], unsigned int maxargs,
|
||||
unsigned long *sp, unsigned long *pc);
|
||||
extern int task_current_syscall(struct task_struct *target, struct syscall_info *info);
|
||||
|
||||
extern void sigaction_compat_abi(struct k_sigaction *act, struct k_sigaction *oact);
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user