From: Oleg Nesterov <oleg@tv-sign.ru>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>
Subject: [BUG] [3d RESEND] de_thread()
Date: Wed, 16 Oct 2002 18:32:10 +0400 [thread overview]
Message-ID: <3DAD786A.E238B234@tv-sign.ru> (raw)
Hello.
On Thu, 10 Oct 2002, Oleg Nesterov wrote:
>
> Suppose process P in thread group was cloned _without_
> CLONE_DETACHED flag. Then another thread, group_leader
> for simplicity, does exec and calls de_thread(). It kills
> P via _broadcast_thread_group(). While doing do_exit(),
> P skips release_task(), because its exit_signal != -1,
> and becomes TASK_ZOMBIE.
>
> Then leader calls schedule() with TASK_UNINTERRUPTIBLE
> in while(oldsig->count > 1) {...} and sleeps forever,
> because nobody can do wake_up_process(sig->group_exit_task).
>
This program should hang leaving task in D state.
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <asm/unistd.h>
#define CLONE_SIGHAND 0x00000800
#define CLONE_THREAD 0x00010000
#define __NR_sys_clone __NR_clone
static inline _syscall2(int,sys_clone, int,flag, void*,stack)
int main(void)
{
static char stack[1024];
int pid = sys_clone(CLONE_THREAD | CLONE_SIGHAND | SIGCHLD, stack);
if (pid < 0) {
printf("ERR!! clone: %s.\n", strerror(errno));
return -1;
}
if (pid == 0) _exit(0);
execlp("echo", "echo", "Should not happen.", 0);
printf("ERR!! exec: %s.\n", strerror(errno));
return 0;
}
Oleg.
reply other threads:[~2002-10-16 14:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3DAD786A.E238B234@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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®