Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80061
b: refs/heads/master
c: c269f19
h: refs/heads/master
i:
  80059: 6568744
v: v3
  • Loading branch information
Roland McGrath authored and Ingo Molnar committed Jan 30, 2008
1 parent 43d8369 commit 7413429
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 032d82d9065dec0e26718eca376c2029e4bd0595
refs/heads/master: c269f19617f508cc5c29c0b064c1a437d7011a46
7 changes: 7 additions & 0 deletions trunk/include/linux/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ extern int compat_ptrace_request(struct task_struct *child,
compat_long_t request,
compat_ulong_t addr, compat_ulong_t data);

#ifdef __ARCH_WANT_COMPAT_SYS_PTRACE
extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
compat_ulong_t addr, compat_ulong_t data);
asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
compat_long_t addr, compat_long_t data);
#endif /* __ARCH_WANT_COMPAT_SYS_PTRACE */

/*
* epoll (fs/eventpoll.c) compat bits follow ...
*/
Expand Down
46 changes: 46 additions & 0 deletions trunk/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,4 +644,50 @@ int compat_ptrace_request(struct task_struct *child, compat_long_t request,

return ret;
}

#ifdef __ARCH_WANT_COMPAT_SYS_PTRACE
asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
compat_long_t addr, compat_long_t data)
{
struct task_struct *child;
long ret;

/*
* This lock_kernel fixes a subtle race with suid exec
*/
lock_kernel();
if (request == PTRACE_TRACEME) {
ret = ptrace_traceme();
goto out;
}

child = ptrace_get_task_struct(pid);
if (IS_ERR(child)) {
ret = PTR_ERR(child);
goto out;
}

if (request == PTRACE_ATTACH) {
ret = ptrace_attach(child);
/*
* Some architectures need to do book-keeping after
* a ptrace attach.
*/
if (!ret)
arch_ptrace_attach(child);
goto out_put_task_struct;
}

ret = ptrace_check_attach(child, request == PTRACE_KILL);
if (!ret)
ret = compat_arch_ptrace(child, request, addr, data);

out_put_task_struct:
put_task_struct(child);
out:
unlock_kernel();
return ret;
}
#endif /* __ARCH_WANT_COMPAT_SYS_PTRACE */

#endif /* CONFIG_COMPAT */

0 comments on commit 7413429

Please sign in to comment.