Re: More waitpid issues with CLONE_DETACHED/CLONE_THREAD
From: Linus Torvalds
Date: Sun Feb 01 2004 - 16:44:33 EST
On Sun, 1 Feb 2004, Daniel Jacobowitz wrote:
>
> Here you go. The bug turns out not to be related directly to
> CLONE_DETACHED. Compile testcase with -DNOTHREAD to use fork (well,
> clone, but without the fancy flags), without -DNOTHREAD to use
> CLONE_DETACHED | CLONE_THREAD.
I don't think this bug has anything to do with anything else.
This program seems to show that PTRACE_KILL simply doesn't work.
What ptrace_kill() does is effectively:
- stage 1: ptrace_check_attach(): wait for child stopped
- stage 2: PTRACE_KILL does:
child->exit_code = SIGKILL;
wake_up_process(child);
and the thing is, it looks like the signal handling changes have totally
made the child ignore the "exit_code" thing, unless I'm seriously
misreading something.
Roland, you know this code better than I do. Any comments?
I suspect the PTRACE_KILL logic should also do a
spin_lock_irqsave(child->sighand->siglock, flags);
sigaddset(&child->pending->signal, SIGKILL);
set_tsk_thread_flag(child, TIF_SIGPENDING);
spin_unlock_irqrestore(child->sighand->siglock, flags);
ptrace_detach(child);
which would set the SIGKILL thing properly, but I suspect we had a good
reason not to do it that way originally.
Daniel?
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/