SIGCHLD race condition?
Carson Gaspar
carson at taltos.org
Thu Sep 27 23:40:09 EST 2001
There is another race (from serverloop.c):
if (child_terminated) {
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
session_close_by_pid(pid, status);
child_terminated = 0;
}
It is possible to loose a child under the following situation:
- wait for all children
- receive SIGCHLD, handler sets child_terminated to 1
- main code sets child_terminated to 0
You must block SIGCHLD delivery before the while loop, and unblock after
the assignment.
NOTE: You'll _probably_ only ever see this race on SMP systems, and even
then the race is very small.
--
Carson
More information about the openssh-unix-dev
mailing list