diff options
-rw-r--r-- | kernel/exit.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 1f2c15297f2d..b5ff2b121093 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -1511,12 +1511,6 @@ static int wait_task_continued(struct task_struct *p, int noreap, | |||
1511 | return retval; | 1511 | return retval; |
1512 | } | 1512 | } |
1513 | 1513 | ||
1514 | |||
1515 | static inline int my_ptrace_child(struct task_struct *p) | ||
1516 | { | ||
1517 | return p->ptrace & PT_PTRACED; | ||
1518 | } | ||
1519 | |||
1520 | static long do_wait(pid_t pid, int options, struct siginfo __user *infop, | 1514 | static long do_wait(pid_t pid, int options, struct siginfo __user *infop, |
1521 | int __user *stat_addr, struct rusage __user *ru) | 1515 | int __user *stat_addr, struct rusage __user *ru) |
1522 | { | 1516 | { |
@@ -1555,22 +1549,11 @@ repeat: | |||
1555 | /* | 1549 | /* |
1556 | * It's stopped now, so it might later | 1550 | * It's stopped now, so it might later |
1557 | * continue, exit, or stop again. | 1551 | * continue, exit, or stop again. |
1558 | * | ||
1559 | * When we hit the race with PTRACE_ATTACH, we | ||
1560 | * will not report this child. But the race | ||
1561 | * means it has not yet been moved to our | ||
1562 | * ptrace_children list, so we need to set the | ||
1563 | * flag here to avoid a spurious ECHILD when | ||
1564 | * the race happens with the only child. | ||
1565 | */ | 1552 | */ |
1566 | flag = 1; | 1553 | flag = 1; |
1567 | 1554 | if (!(p->ptrace & PT_PTRACED) && | |
1568 | if (!my_ptrace_child(p)) { | 1555 | !(options & WUNTRACED)) |
1569 | if (task_is_traced(p)) | 1556 | continue; |
1570 | continue; | ||
1571 | if (!(options & WUNTRACED)) | ||
1572 | continue; | ||
1573 | } | ||
1574 | 1557 | ||
1575 | retval = wait_task_stopped(p, ret == 2, | 1558 | retval = wait_task_stopped(p, ret == 2, |
1576 | (options & WNOWAIT), infop, | 1559 | (options & WNOWAIT), infop, |