Commit 975639b1 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] wait4-fix-2.5.34-B2, BK-curr

This fixes a number of bugs that broke ptrace:

 - wait4 must not inhibit TASK_STOPPED processes even for thread group
   leaders.

 - do_notify_parent() should not delay the notification of parents if
   the thread in question is ptraced.

strace now works as expected for CLONE_THREAD applications as well.
parent a8194b4e
...@@ -770,11 +770,6 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc ...@@ -770,11 +770,6 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc
if (!ret) if (!ret)
continue; continue;
flag = 1; flag = 1;
/*
* Eligible but we cannot release it yet:
*/
if (ret == 2)
continue;
switch (p->state) { switch (p->state) {
case TASK_STOPPED: case TASK_STOPPED:
...@@ -798,6 +793,11 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc ...@@ -798,6 +793,11 @@ asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr, int options, struc
} }
goto end_wait4; goto end_wait4;
case TASK_ZOMBIE: case TASK_ZOMBIE:
/*
* Eligible but we cannot release it yet:
*/
if (ret == 2)
continue;
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0; retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
if (!retval && stat_addr) { if (!retval && stat_addr) {
......
...@@ -1105,7 +1105,7 @@ void do_notify_parent(struct task_struct *tsk, int sig) ...@@ -1105,7 +1105,7 @@ void do_notify_parent(struct task_struct *tsk, int sig)
struct siginfo info; struct siginfo info;
int why, status; int why, status;
if (delay_group_leader(tsk)) if (!tsk->ptrace && delay_group_leader(tsk))
return; return;
if (sig == -1) if (sig == -1)
BUG(); BUG();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment