sshd Termination by SIGALRM

spatil spatil at
Wed Mar 7 00:37:02 EST 2007

     I am seeing a problem where in sshd gets terminated by SIGALRM. 
sshd was listening on the socket and was not restarted.
I saw a recent bug fix in openBSD openssh CVS which mentions:

	Clear alarm() before restarting sshd on SIGHUP.  Without this, if there's
	a SIGALRM pending (for SSH1 key regeneration) when sshd is SIGHUP'ed, the
	newly exec'ed sshd will get the SIGALRM and not have a handler for it,
	and the default action will terminate the listening sshd.  Analysis and
	patch from andrew at

In my case no such signal was received.

I am using OpenSSH 3.8.1p1 on FC3 with linux- kernel. The 
signal system call in Linux might fail
if there is any pending signal for the process. It returns 
ERESTARTNOINTR. The following code in openssh

                /* Mark that the key has been used (it was "given" to 
the child). */
                if ((options.protocol & SSH_PROTO_1) &&
                    key_used == 0) {
                    /* Schedule server key regeneration alarm. */
                    signal(SIGALRM, key_regeneration_alarm);
                    key_used = 1;
might cause a problem if signal call fails because of the above stated 
reason. In such a case the default handler (SIG_DFL which is terminate)
gets called since alarm function gets executed anyways.

Is my analysis correct ?

More information about the openssh-unix-dev mailing list