bugzilla-daemon at bugzilla.mindrot.org
2010-Jan-14 14:43 UTC
[Bug 1698] New: Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698
Summary: Connection stalls on PTY allocation failure
Product: Portable OpenSSH
Version: 5.3p1
Platform: Other
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: sshd
AssignedTo: unassigned-bugs at mindrot.org
ReportedBy: alex at rtfs.hu
If on the server side sshd was not able to allocate a PTY (in my case a
wrongly configured FreeBSD's ugidfw rule wont allow opening those
files) both sshd and the client ssh will stall.
Client ssh log:
debug1: Requesting no-more-sessions at openssh.com
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug2: channel 0: request shell confirm 1
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_confirm: type 100 id 0
PTY allocation request failed on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Server side log:
Jan 14 14:40:09 www sshd[50855]: error: openpty: Permission denied
Jan 14 14:40:09 www sshd[50855]: error: session_pty_req: session 0
alloc failed
--
I traced down this to session.c:session_pty_req:
if (no_pty_flag) {
debug("Allocating a pty not permitted for this
authentication.");
return 0;
}
if (s->ttyfd != -1) {
packet_disconnect("Protocol error: you already have a
pty.");
return 0;
}
...
debug("Allocating pty.");
if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty,
sizeof(s->tty)))) {
if (s->term)
xfree(s->term);
s->term = NULL;
s->ptyfd = -1;
s->ttyfd = -1;
error("session_pty_req: session %d alloc failed",
s->self);
return 0;
}
--
I am not that deeply into openssh but to me it looks like a
packet_disconnect() might be missing after the error().
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2010-Jan-14 22:57 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698
Darren Tucker <dtucker at zip.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dtucker at zip.com.au
--- Comment #1 from Darren Tucker <dtucker at zip.com.au> 2010-01-15
09:57:28 EST ---
I think it's a bug in the client failing to handle the pty allocation
failure. I looked at this once before but at the time the code made if
very difficult to associate the failure message with the pty request.
We've improved it since then so it might be time to take another look.
You can't just disconnect. A single sshd can have multiple sessions
and thus multiple ptys, so the failure to allocate one should not cause
the connection to terminate.
--
Configure bugmail: https://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.
bugzilla-daemon at bugzilla.mindrot.org
2010-Jan-15 01:36 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698 --- Comment #2 from Alex Beregszaszi <alex at rtfs.hu> 2010-01-15 12:36:04 EST --- If you say this must be handled on the client part, then maybe in clientloop.c:client_session2_setup() the do_close parameter might be changed to 1 in client_expect_confirm(id, "PTY allocation", 0); inside the want_tty if branch. Looks like that will terminate only that channel. Also notice the comment there: XXX wait for reply -- Configure bugmail: https://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.
bugzilla-daemon at bugzilla.mindrot.org
2010-Jan-15 04:22 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |djm at mindrot.org
--- Comment #3 from Damien Miller <djm at mindrot.org> 2010-01-15 15:22:33
EST ---
yes, the reply callback infrastructure is quite new and not everything
uses it yet
--
Configure bugmail: https://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.
bugzilla-daemon at bugzilla.mindrot.org
2010-Apr-09 00:35 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698 --- Comment #4 from Damien Miller <djm at mindrot.org> 2010-04-09 10:35:25 EST --- Created an attachment (id=1830) --> (https://bugzilla.mindrot.org/attachment.cgi?id=1830) kill-on-pty-fail.diff Kill channel on PTY allocation failure -- Configure bugmail: https://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.
bugzilla-daemon at bugzilla.mindrot.org
2010-Apr-09 00:36 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698 --- Comment #5 from Damien Miller <djm at mindrot.org> 2010-04-09 10:36:18 EST --- Created an attachment (id=1831) --> (https://bugzilla.mindrot.org/attachment.cgi?id=1831) kill-on-pty-fail2.diff Kill channel on PTY allocation failure -- Configure bugmail: https://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.
bugzilla-daemon at bugzilla.mindrot.org
2010-Apr-09 00:36 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #1830|0 |1
is obsolete| |
--
Configure bugmail: https://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.
bugzilla-daemon at bugzilla.mindrot.org
2010-Apr-09 00:38 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |1708
--
Configure bugmail: https://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.
bugzilla-daemon at bugzilla.mindrot.org
2010-Apr-10 05:54 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #6 from Damien Miller <djm at mindrot.org> 2010-04-10 15:54:37
EST ---
patch applied - will be in OpenSSH 5.6p1
--
Configure bugmail: https://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.
bugzilla-daemon at bugzilla.mindrot.org
2011-Jan-24 01:33 UTC
[Bug 1698] Connection stalls on PTY allocation failure
https://bugzilla.mindrot.org/show_bug.cgi?id=1698
Damien Miller <djm at mindrot.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
--- Comment #7 from Damien Miller <djm at mindrot.org> 2011-01-24 12:33:50
EST ---
Move resolved bugs to CLOSED after 5.7 release
--
Configure bugmail: https://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.