Re: [RFC,PATCH 1/2] signals: re-assign CLD_CONTINUED notification from the sender to reciever

From: Oleg Nesterov
Date: Thu Mar 06 2008 - 21:41:08 EST


On 03/06, Roland McGrath wrote:
>
> I like this version fine, but I would like to see that comment in
> get_signal_to_deliver added in a cleanup patch.

Yes. Will do.

>From another message:
>
> > Perhaps, we can add the new helper which sets SIGNAL_GROUP_EXIT but preserves
> > SIGNAL_CLD_MASK, but I don't think this is really needed.
>
> Actually, I think it is. This made think of another pedantic concern.
> (Not that I'm sure we get this right now anyway.)

This "I don't think this is really needed" above meant that the patch doesn't
make things worse than we currently have, but

> Say a child was previously stopped, parent had seen CLD_STOPPED and done
> WSTOPPED wait. Now we send SIGCONT followed shortly by SIGTERM (unhandled
> fatal signal). In the interval before the SIGTERM has yet been dequeued
> (nor SIGKILLs sent to other threads by __group_complete_signal), the parent
> does waitpid(pid, WSTOPPED|WCONTINUED|WEXITED|WNOHANG). It should see one
> of: WIFSTOPPED (still); WIFSIGNALED (dead); WIFCONTINUED. Instead, waitpid
> will return 0 (it's running, not stopped, not continued). This says
> SIGNAL_STOP_CONTINUED ought to function as normal (i.e. WCONTINUED polling)
> until we're actually ready for wait to report the process as dead.

Good point, completely agreed. (except I think it doesn't matter was that
fatal signal dequeued or not).

> We already break this pedantic nit because flags = SIGNAL_GROUP_EXIT clears
> SIGNAL_STOP_CONTINUED. But if we clean up all flags usage, I think we
> should make it preserve SIGNAL_STOP_CONTINUED.
>
> But if we were to make wait key on SIGNAL_STOP_STOPPED, as is
> probably necessary to do WSTOPPED waits for processes with a zombie
> group_leader, then this too could be made consistent. (Leave the
> SIGNAL_STOP_STOPPED bit set throughout, so WSTOPPED|WNOHANG waits continues
> to report it as stopped until it actually dies.)

Yes, thanks. Will try to do a bit later.

Oleg.

--
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/