sshd Termination by SIGALRM
spatil
spatil at sonoasystems.com
Wed Mar 7 00:37:02 EST 2007
Hi,
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 gaul.org.
In my case no such signal was received.
I am using OpenSSH 3.8.1p1 on FC3 with linux-2.6.16.13 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
sshd.c:main():
/* 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);
alarm(options.key_regeneration_time);
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