From: Andreas Schwab <schwab@suse.de>
To: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>, Andrea Arcangeli <andrea@suse.de>,
linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Subject: Re: zombie with CLONE_THREAD
Date: Wed, 30 Jun 2004 11:04:46 +0200 [thread overview]
Message-ID: <je8ye5ct75.fsf@sykes.suse.de> (raw)
In-Reply-To: <200406300714.i5U7E48O027579@magilla.sf.frob.com> (Roland McGrath's message of "Wed, 30 Jun 2004 00:14:04 -0700")
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
Roland McGrath <roland@redhat.com> writes:
> Are you saying that if the ptracer dies, it can leave some threads in limbo?
> I think that case is supposed to work because forget_original_parent will
> move all the threads ptrace'd by the dying tracer process to be ptrace'd by
> init, which will then clean up their zombies as previously described.
Here is the test case, run it with "strace -f ./clone". When the bug
happens then strace is stuck waiting for it's traced child that just died,
but you may have to try a few times before it happens.
[-- Attachment #2: clone.c --]
[-- Type: text/plain, Size: 966 bytes --]
#include <stdio.h>
#include <signal.h>
#include <sched.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
extern int __clone (int (*__fn) (void *__arg), void *__child_stack,
int __flags, void *__arg, ...);
extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
size_t __child_stack_size, int __flags, void *__arg, ...);
static int thread (void *arg)
{
write (2, "thread\n", sizeof ("thread\n"));
*(volatile int *) 0;
return 0;
}
#define STACK_SIZE 1024 * 1024
#define CLONE_FLAGS CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM
int
main (void)
{
void *stack = mmap (0, STACK_SIZE, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_PRIVATE, -1, 0);
pid_t pid;
#ifdef __ia64__
pid = __clone2 (thread, stack, STACK_SIZE - 64, CLONE_FLAGS, 0);
#else
pid = __clone (thread, stack + STACK_SIZE - 64, CLONE_FLAGS, 0);
#endif
printf ("pid = %d\n", pid);
sleep (1);
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2004-06-30 9:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-30 6:00 Andrea Arcangeli
2004-06-30 6:08 ` Andrew Morton
2004-06-30 7:14 ` Roland McGrath
2004-06-30 9:04 ` Andreas Schwab [this message]
2004-07-01 3:22 ` Roland McGrath
2004-07-01 4:08 ` Andrea Arcangeli
2004-07-01 4:42 ` Linus Torvalds
2004-07-01 5:39 ` Roland McGrath
2004-07-01 5:56 ` Linus Torvalds
2004-07-01 7:06 ` Roland McGrath
2004-07-01 14:26 ` Andrea Arcangeli
2004-07-01 21:33 ` Roland McGrath
2004-07-01 15:49 ` Linus Torvalds
2004-07-01 16:23 ` Andrea Arcangeli
2004-07-01 16:43 ` Linus Torvalds
2004-07-01 20:27 ` Roland McGrath
2004-07-01 4:57 ` Linus Torvalds
2004-07-01 7:02 ` Roland McGrath
2004-07-01 16:50 ` Linus Torvalds
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=je8ye5ct75.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=torvalds@osdl.org \
/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®