Commit 4abf986960ecda6a87fc2f795aacf888a2f0127e

Authored by Namhyung Kim
Committed by Linus Torvalds
1 parent c4b5ed250e

ptrace: change signature of sys_ptrace() and friends

Since userspace API of ptrace syscall defines @addr and @data as void
pointers, it would be more appropriate to define them as unsigned long in
kernel.  Therefore related functions are changed also.

'unsigned long' is typically used in other places in kernel as an opaque
data type and that using this helps cleaning up a lot of warnings from
sparse.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 3 changed files with 18 additions and 10 deletions Side-by-side Diff

include/linux/ptrace.h
... ... @@ -108,7 +108,8 @@
108 108 extern int ptrace_detach(struct task_struct *, unsigned int);
109 109 extern void ptrace_disable(struct task_struct *);
110 110 extern int ptrace_check_attach(struct task_struct *task, int kill);
111   -extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
  111 +extern int ptrace_request(struct task_struct *child, long request,
  112 + unsigned long addr, unsigned long data);
112 113 extern void ptrace_notify(int exit_code);
113 114 extern void __ptrace_link(struct task_struct *child,
114 115 struct task_struct *new_parent);
... ... @@ -132,8 +133,10 @@
132 133 __ptrace_unlink(child);
133 134 }
134 135  
135   -int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data);
136   -int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
  136 +int generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr,
  137 + unsigned long data);
  138 +int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr,
  139 + unsigned long data);
137 140  
138 141 /**
139 142 * task_ptrace - return %PT_* flags that apply to a task
include/linux/syscalls.h
... ... @@ -701,7 +701,8 @@
701 701 asmlinkage long sys_syslog(int type, char __user *buf, int len);
702 702 asmlinkage long sys_uselib(const char __user *library);
703 703 asmlinkage long sys_ni_syscall(void);
704   -asmlinkage long sys_ptrace(long request, long pid, long addr, long data);
  704 +asmlinkage long sys_ptrace(long request, long pid, unsigned long addr,
  705 + unsigned long data);
705 706  
706 707 asmlinkage long sys_add_key(const char __user *_type,
707 708 const char __user *_description,
... ... @@ -404,7 +404,7 @@
404 404 return copied;
405 405 }
406 406  
407   -static int ptrace_setoptions(struct task_struct *child, long data)
  407 +static int ptrace_setoptions(struct task_struct *child, unsigned long data)
408 408 {
409 409 child->ptrace &= ~PT_TRACE_MASK;
410 410  
... ... @@ -483,7 +483,8 @@
483 483 #define is_sysemu_singlestep(request) 0
484 484 #endif
485 485  
486   -static int ptrace_resume(struct task_struct *child, long request, long data)
  486 +static int ptrace_resume(struct task_struct *child, long request,
  487 + unsigned long data)
487 488 {
488 489 if (!valid_signal(data))
489 490 return -EIO;
... ... @@ -560,7 +561,7 @@
560 561 #endif
561 562  
562 563 int ptrace_request(struct task_struct *child, long request,
563   - long addr, long data)
  564 + unsigned long addr, unsigned long data)
564 565 {
565 566 int ret = -EIO;
566 567 siginfo_t siginfo;
... ... @@ -693,7 +694,8 @@
693 694 #define arch_ptrace_attach(child) do { } while (0)
694 695 #endif
695 696  
696   -SYSCALL_DEFINE4(ptrace, long, request, long, pid, long, addr, long, data)
  697 +SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr,
  698 + unsigned long, data)
697 699 {
698 700 struct task_struct *child;
699 701 long ret;
... ... @@ -734,7 +736,8 @@
734 736 return ret;
735 737 }
736 738  
737   -int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data)
  739 +int generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr,
  740 + unsigned long data)
738 741 {
739 742 unsigned long tmp;
740 743 int copied;
... ... @@ -745,7 +748,8 @@
745 748 return put_user(tmp, (unsigned long __user *)data);
746 749 }
747 750  
748   -int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data)
  751 +int generic_ptrace_pokedata(struct task_struct *tsk, unsigned long addr,
  752 + unsigned long data)
749 753 {
750 754 int copied;
751 755