From: Linus Torvalds <torvalds@transmeta.com>
To: tachino@open.nm.fujitsu.co.jp, linux-kernel@vger.kernel.org
Subject: Re: [BUG 2.4.6] PPID of a process is set to itself
Date: Mon, 16 Jul 2001 21:41:56 -0700 [thread overview]
Message-ID: <200107170441.f6H4fux15702@penguin.transmeta.com> (raw)
In-Reply-To: <k818gp7s.wl@nisaaru.open.nm.fujitsu.co.jp>
In article <k818gp7s.wl@nisaaru.open.nm.fujitsu.co.jp> 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.
Heh.
>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
>group?
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?
Thanks,
Linus
------
--- 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->run_list.next = 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;
next prev parent reply other threads:[~2001-07-17 4:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-17 4:21 Tachino Nobuhiro
2001-07-17 4:41 ` Linus Torvalds [this message]
2001-07-17 6:10 ` Tachino Nobuhiro
2001-07-17 6:40 ` Linus Torvalds
2001-07-17 7:08 ` Ulrich Drepper
2001-07-17 23:13 ` huge number of context switches under 2.2.x with SMP & threaded apps bert hubert
2001-07-17 23:29 ` huge number of context switches under 2.2.x with SMP & threa Davide Libenzi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200107170441.f6H4fux15702@penguin.transmeta.com \
--to=torvalds@transmeta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tachino@open.nm.fujitsu.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®