[lkml]   [2001]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [BUG 2.4.6] PPID of a process is set to itself
In article <> you write:
>When I am playing with clone system call, I found the case the cloned process
>becomes the zombie which is not reaped because the PPID of the process is
>set to itself. The test program are following.


>Following patch fixes the bug, but I don't know this is correct. Can
>someone please explain me why in forget_original_parent(), the parent of
>processes in a thread group is set to another process in the thread

The point with "CLONE_THREAD" is to create a sibling that is a more
"traditional" thread in the sense that it is more identical to the
original clonee - sharing the same thread group etc, so that we can
implement full POSIX pthreads semantics.

HOWEVER, the bug you hit is because CLONE_THREAD also implies
CLONE_PARENT, and the fork() code didn't actually enforce this. So
instead of your patch, we just should not allow the parent and the child
to be in the same thread group. Suggested real patch appended. Does this
fix it for you too?



--- linux-orig/kernel/fork.c Mon Apr 30 22:23:29 2001
+++ linux/kernel/fork.c Mon Jul 16 21:38:11 2001
@@ -604,7 +604,7 @@
p-> = NULL;
p->run_list.prev = NULL;

- if ((clone_flags & CLONE_VFORK) || !(clone_flags & CLONE_PARENT)) {
+ if ((clone_flags & CLONE_VFORK) || !(clone_flags & (CLONE_PARENT | CLONE_THREAD))) {
p->p_opptr = current;
if (!(p->ptrace & PT_PTRACED))
p->p_pptr = current;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:57    [W:4.758 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site