SIGCHLD race condition?

Nicolas Williams Nicolas.Williams at ubsw.com
Thu Oct 4 04:53:15 EST 2001


On Wed, Oct 03, 2001 at 01:47:59PM -0500, mouring at etoh.eviladmin.org wrote:
> On Wed, 3 Oct 2001, Nicolas Williams wrote:
> > It's a neat trick. SIGCHLD arrives and the handler reaps the child and
> > writes a byte to this place holder pipe, then, when the select() loop is
> > entered you come out because there's that byte in the pipe, you check
> > the child terminated variable and you exit. No more race condition.
> >
> 
> Neat trick, but I've seen scp terminate with a SIGCHLD before the pipe was
> empty.

There's no such pipe in the code now. It'd be merely a place holder to
tie the SIGCHLD/wait() event to select().

SSHD would still only exit IFF (child is dead && child fildes are dead).

The pipe trick is merely a race avoidance technique.

> I guess I'd have to see the code since I get a feeling we could lose data
> on non-interactive session with this trick.  I'd rather track down what C
> code is holding the offending file descriptor past's the due date and
> rework the code.  I'm not too much a fan of repeating the last 'scp
> missing data' thread.

Wrong thread, methinks. This is the sigchld-arrived-before-entering-
select()-but-after-checking-child_terminated-and-client-has-nothing-
to-send-and-the-child's-fildes-are-closed-therefore-sshd-ends-up-
waiting-forever-in-select()-for-the-client-to-send-something thread.

> But I'd be damned if I can find it.  <frown>
> 
> - Ben


Nico
--
-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-

Visit our website at http://www.ubswarburg.com

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.




More information about the openssh-unix-dev mailing list