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

From: Andris Pavenis (pavenis@latnet.lv)
Date: Wed May 17 2000 - 03:41:59 EST


On Sat, 13 May 2000, Mike Coleman wrote:
> 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;
>
>

This patch fixed my problems (I'm still using patched 2.3.99-pre6).
For example I tried to run IDE I mentioned as debugee under itself
and so trace with it test example which also uses system().

But the example recently posted
        strace /usr/bin/strace /bin/true

coredumps for me (also if I use my test examples instead of /bin/true)

Andris

-
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 : Tue May 23 2000 - 21:00:12 EST