Re: [PATCH] [RFC] fix missed SIGCONT cases

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Roland McGrath
Date: Thursday, March 6, 2008 - 3:50 am

> Actually, it is easy to re-use signal_struct->flags from the very beginning,

Looks like a good start.


Actually, I think it is.  This made think of another pedantic concern.
(Not that I'm sure we get this right now anyway.)

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.

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.

I'll admit it's thin since a SIGKILL not yet dequeued or in the middle of
delivery brings the task to running so WNOHANG wait won't report it as
still stopped, won't report it for WCONTINUED at all, and won't report it
as dead yet.  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.)


This should have a comment before the block.  Explain that it is finishing
the report set up by handle_stop_signal while we were in TASK_STOPPED in a
previous iteration here inside get_signal_to_deliver.


Thanks,
Roland
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [RFC] fix missed SIGCONT cases, Jiri Kosina, (Wed Feb 27, 8:22 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Roland McGrath, (Wed Feb 27, 2:00 pm)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Jiri Kosina, (Wed Feb 27, 3:04 pm)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Roland McGrath, (Thu Feb 28, 3:26 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Jiri Kosina, (Thu Feb 28, 4:42 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Oleg Nesterov, (Thu Feb 28, 8:30 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Jiri Kosina, (Thu Feb 28, 8:32 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Oleg Nesterov, (Thu Feb 28, 8:32 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Jiri Kosina, (Thu Feb 28, 8:40 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Oleg Nesterov, (Thu Feb 28, 9:08 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Jiri Kosina, (Thu Feb 28, 9:13 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Roland McGrath, (Thu Feb 28, 7:39 pm)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Oleg Nesterov, (Fri Feb 29, 5:01 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Oleg Nesterov, (Fri Feb 29, 6:20 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Roland McGrath, (Fri Feb 29, 6:59 pm)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Oleg Nesterov, (Sat Mar 1, 9:41 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Oleg Nesterov, (Mon Mar 3, 6:25 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Roland McGrath, (Thu Mar 6, 2:05 am)
Re: [PATCH] [RFC] fix missed SIGCONT cases, Roland McGrath, (Thu Mar 6, 3:50 am)