Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20339
b: refs/heads/master
c: 5ecfbae
h: refs/heads/master
i:
  20337: dd663b5
  20335: 4b17c9d
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Feb 15, 2006
1 parent acfae6b commit e7c0930
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 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: dadac81b1b86196fcc48fb87620403c4a7174f06
refs/heads/master: 5ecfbae093f0c37311e89b29bfc0c9d586eace87
2 changes: 1 addition & 1 deletion trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ static void zap_threads (struct mm_struct *mm)
do_each_thread(g,p) {
if (mm == p->mm && p != tsk &&
p->ptrace && p->parent->mm == mm) {
__ptrace_unlink(p);
__ptrace_detach(p, 0);
}
} while_each_thread(g,p);
write_unlock_irq(&tasklist_lock);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/ptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __us
extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
extern int ptrace_attach(struct task_struct *tsk);
extern int ptrace_detach(struct task_struct *, unsigned int);
extern void __ptrace_detach(struct task_struct *, unsigned int);
extern void ptrace_disable(struct task_struct *);
extern int ptrace_check_attach(struct task_struct *task, int kill);
extern int ptrace_request(struct task_struct *child, long request, long addr, long data);
Expand Down
25 changes: 15 additions & 10 deletions trunk/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void ptrace_untrace(task_t *child)
*/
void __ptrace_unlink(task_t *child)
{
if (!child->ptrace)
BUG();
BUG_ON(!child->ptrace);

child->ptrace = 0;
if (!list_empty(&child->ptrace_list)) {
list_del_init(&child->ptrace_list);
Expand Down Expand Up @@ -184,22 +184,27 @@ int ptrace_attach(struct task_struct *task)
return retval;
}

void __ptrace_detach(struct task_struct *child, unsigned int data)
{
child->exit_code = data;
/* .. re-parent .. */
__ptrace_unlink(child);
/* .. and wake it up. */
if (child->exit_state != EXIT_ZOMBIE)
wake_up_process(child);
}

int ptrace_detach(struct task_struct *child, unsigned int data)
{
if (!valid_signal(data))
return -EIO;
return -EIO;

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

/* .. re-parent .. */
child->exit_code = data;

write_lock_irq(&tasklist_lock);
__ptrace_unlink(child);
/* .. and wake it up. */
if (child->exit_state != EXIT_ZOMBIE)
wake_up_process(child);
if (child->ptrace)
__ptrace_detach(child, data);
write_unlock_irq(&tasklist_lock);

return 0;
Expand Down

0 comments on commit e7c0930

Please sign in to comment.