[Bug 1363] sshd gets stuck: select() in packet_read_seqnr waits indefinitely

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Tue Sep 18 09:30:42 EST 2007


http://bugzilla.mindrot.org/show_bug.cgi?id=1363





--- Comment #2 from Matt Day <openssh at fjarlq.com>  2007-09-18 09:30:37 ---
(In reply to comment #1)
> I think you need to reset packet_wait_tv before each select call. Linux
> at least will modify the timeout parameter to the contain the amount of
> time remaining, and apparently this behaviour is permitted by POSIX.

Good observation -- I agree.

In addition to the patch, this sort of select-loop with timeout appears
in the following OpenSSH 4.7 places:
* conloop() (ssh-keyscan.c)
* timeout_connect (sshconnect.c)

I'm not familiar with that code, but must not be portable for the same
reason.

In the patch, the purpose of the select-loop is to wait for the socket
to become ready. In OpenSSH 4.7, the packet.c routines wait forever. So
the patch introduces a timeout which is enabled on systems using the
SSH keepalive.

So, I think the patch is actually *correct* on Linux. On systems like
FreeBSD that do not change the select-timeval, the select-loop would
start the timer over from the beginning each time EAGAIN or EINTR
occurred. So if signals kept going off, sshd could still get stuck
indefinitely in that loop.

So I believe the correct fix should keep track of its own time and pass
the correct amount of remaining time period into select().


-- 
Configure bugmail: http://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list