[PATCH] fork.c bug (fixes "waitpid() fails when running under debugger")

From: Mike Coleman (mcoleman2@kc.rr.com)
Date: Fri May 12 2000 - 19:27:41 EST


This patch fixes a bug in forking that's causing ptrace reparenting to happen
in cases where it shouldn't. (The bug was introduced in a patch I submitted
that was included in 2.3.99-pre1.)

Specifically, in the case where a process is being traced, it forks, and
CLONE_PTRACE is not set, the new child shouldn't be reparented (as it is not
being traced).

This fixes the problem noted by Andris Pavenis <pavenis@latnet.lv>, in which
wait fails to work correctly for a strace'd process.

--Mike

--- kernel/fork.c.dist Tue May 2 00:29:14 2000
+++ kernel/fork.c Fri May 12 17:40:55 2000
@@ -674,7 +674,7 @@
 
         if ((clone_flags & CLONE_VFORK) || !(clone_flags & CLONE_PARENT)) {
                 p->p_opptr = current;
- if (!(current->flags & PF_PTRACED))
+ if (!(p->flags & PF_PTRACED))
                         p->p_pptr = current;
         }
         p->p_cptr = NULL;

-- 
Any sufficiently adverse technology is indistinguishable from Microsoft.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:22 EST