OpenSSH
[Top] [All Lists]

Re: sshd gets stuck: select() in packet_read_seqnr waits indefinitely

To: openssh-unix-dev@mindrot.org
Subject: Re: sshd gets stuck: select() in packet_read_seqnr waits indefinitely
From: Matt Day <opensshbugs@fjarlq.com>
Date: Wed, 14 Mar 2007 19:12:09 -0600
Delivered-to: sp-com-lists@consult.net
Delivered-to: openssh-unix-dev-list1@securepoint.com
Delivered-to: openssh-unix-dev-tmda@mindrot.org
Delivered-to: openssh-unix-dev@mindrot.org
In-reply-to: <20070315001416.GA28880@gate.dtucker.net>
List-archive: <http://lists.mindrot.org/pipermail/openssh-unix-dev>
List-help: <mailto:openssh-unix-dev-request@mindrot.org?subject=help>
List-id: Development of portable OpenSSH <openssh-unix-dev.mindrot.org>
List-post: <mailto:openssh-unix-dev@mindrot.org>
List-subscribe: <http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev>, <mailto:openssh-unix-dev-request@mindrot.org?subject=subscribe>
List-unsubscribe: <http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev>, <mailto:openssh-unix-dev-request@mindrot.org?subject=unsubscribe>
References: <20070314185309.GA40932@fjarlq.com> <20070315001416.GA28880@gate.dtucker.net>
Sender: openssh-unix-dev-bounces+openssh-unix-dev-list1=securepoint.com@mindrot.org
User-agent: Mutt/1.4.2.1i
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?

Thanks,
Matt
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
http://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

<Prev in Thread] Current Thread [Next in Thread>