SIGCHLD race *trivial* patch

Ed Phillips ed at UDel.Edu
Fri Oct 26 23:11:06 EST 2001


On Thu, 25 Oct 2001, Markus Friedl wrote:

> Date: Thu, 25 Oct 2001 23:12:28 +0200
> From: Markus Friedl <markus at openbsd.org>
> To: openssh-unix-dev at mindrot.org
> Subject: Re: SIGCHLD race *trivial* patch
>
> 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.

siglongjmp?  Talk about ugly... ;-P

Off the cuff... how about alarm() + handler?  Is that more portable than
select() with a
timeout?

	Ed

Ed Phillips <ed at udel.edu> University of Delaware (302) 831-6082
Systems Programmer III, Network and Systems Services
finger -l ed at polycut.nss.udel.edu for PGP public key




More information about the openssh-unix-dev mailing list