[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:41:21 EST 2007


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





--- Comment #3 from Damien Miller <djm at mindrot.org>  2007-09-18 09:41:14 ---
> In addition to the patch, this sort of select-loop with timeout appears
> in the following OpenSSH 4.7 places:
> * conloop() (ssh-keyscan.c)

I'm not so fussed about this one.

> * timeout_connect (sshconnect.c)

This is fixed in CVS -current. See:

http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/sshconnect.c.diff?r1=1.201&r2=1.202

> 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.

Actually, the patch is incorrect everywhere and possibly badly broken
on Linux. On Linux, the timeout will get smaller and smaller and will
eventually timeout an active connection. On other platforms the
behavior is undefined.

The logic that needs to be implemented is:
    1. Decrease the timeout on EINTR or EAGAIN and retry the select
    2. Reset the timeout on a successful read


-- 
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