SIGCHLD race condition? (fwd)

Paul Menage pmenage at ensim.com
Wed Sep 26 17:54:41 EST 2001


>On Tue, Sep 25, 2001 at 05:43:41PM -0700, Paul Menage wrote:
>> Can anyone offer any advice on this issue? We've tried patching sshd to 
>> have a maximum 10 second timeout when calling select() in serverloop.c, 
>> and this doesn't appear to have had any ill effects.
>
>hm, i'd prefer to fix the real bug...
>

Agreed. But in this case it's not clear if there's a particularly nice
way to do it. I don't think that you can specify that a signal be
blocked until you next call select(). The two possibilities that come to
mind are:

- Hold on to both ends of a pipe, the read end of which gets included in
the select() set. As well as setting child_terminated to 1, the signal
handler writes a single byte to the pipe (non-blocking, and doesn't mind
if it gets EAGAIN). That way the select() will return if the parent
hasn't processed child_terminated yet. (In fact, the pipe could possibly
replace the child_terminated variable entirely.)

- Switch to using queued signals for network readiness events, then use
sigtimedwait() or similar instead of select(). I imagine that this would
be a fairly major overhaul of the networking code.

Paul




More information about the openssh-unix-dev mailing list