Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139690
b: refs/heads/master
c: 4576145
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Apr 3, 2009
1 parent d0f650d commit d20a992
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b1b4c6799fb59e710454bfe0ab477cb8523a8667
refs/heads/master: 4576145c1ecdaaea9ef8976a48335206aa1ebf91
1 change: 1 addition & 0 deletions trunk/include/linux/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ extern void ptrace_notify(int exit_code);
extern void __ptrace_link(struct task_struct *child,
struct task_struct *new_parent);
extern void __ptrace_unlink(struct task_struct *child);
extern int __ptrace_detach(struct task_struct *tracer, struct task_struct *p);
extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags);
#define PTRACE_MODE_READ 1
#define PTRACE_MODE_ATTACH 2
Expand Down
9 changes: 7 additions & 2 deletions trunk/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,25 +237,30 @@ int ptrace_attach(struct task_struct *task)

int ptrace_detach(struct task_struct *child, unsigned int data)
{
int dead = 0;

if (!valid_signal(data))
return -EIO;

/* Architecture-specific hardware disable .. */
ptrace_disable(child);
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);

/* protect against de_thread()->release_task() */
write_lock_irq(&tasklist_lock);
/* protect against de_thread()->release_task() */
if (child->ptrace) {
child->exit_code = data;

__ptrace_unlink(child);
dead = __ptrace_detach(current, child);

if (!child->exit_state)
wake_up_process(child);
}
write_unlock_irq(&tasklist_lock);

if (unlikely(dead))
release_task(child);

return 0;
}

Expand Down

0 comments on commit d20a992

Please sign in to comment.