SIGCHLD race *trivial* patch

Markus Friedl markus at openbsd.org
Fri Oct 26 07:12:28 EST 2001


On Thu, Oct 25, 2001 at 03:25:22PM -0400, Nicolas Williams wrote:
>       if (!channel_still_open())
>               max_time_milliseconds = 1000;

there are no channels when a client authenticates.

just try ssh -N

> 
>    Added this bit of code to server_loop2():
> 
>                 if (child_terminated) {
>                         while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
>                                 session_close_by_pid(pid, status);
> -                       child_terminated = 0;
> +                       if (session_still_used())
> +                               child_terminated = 0;
> +                    if (child_terminated && !channel_still_open())
> +                       break;
			^^^^^
you cannot break. the client decides when the connection gets closed.

i think it could still request another login shell.

but yes, the SIGCLD races could be fixed with a select timeout.

but that's ugly. perhaps using siglongjmp is less ugly
and even portable.

-m



More information about the openssh-unix-dev mailing list