sshd gets stuck: select() in packet_read_seqnr waits indefinitely

Matt Day opensshbugs at
Thu Mar 15 12:12:09 EST 2007

On Thu, Mar 15, 2007 at 11:14:16AM +1100, Darren Tucker wrote:
> You could try the attached patch.

Oh, cool...thanks for the fast response!

I have a question about the patch. With it applied, packet_read_seqnr
now reads:

        /* Wait for some data to arrive. */
        while (select(connection_in + 1, setp, NULL, NULL,
            packet_wait_tvp) == -1 &&
            (errno == EAGAIN || errno == EINTR))

        /* Read data from the socket. */
        len = read(connection_in, buf, sizeof(buf));

On FreeBSD, select() will return 0 upon timeout, so packet_read_seqnr
would end up calling read() even though the descriptor isn't ready,
so I think it would block.

Similarly, I don't see how a select() timeout would cause packet_write_wait
to abort. Instead it would call packet_write_poll (which calls write())
even though the descriptor isn't ready for writing. Am I missing something?


More information about the openssh-unix-dev mailing list