Public bug reported:

Attached to this report is a small app the reproduces the issue by creating 
multiple channels within one sessions. (I fist hit this issue using JSCH 
library)
Following information is printed to stdout if sshd is launched with -d flags 
(I've modified the sshd code to print PIDs next to debug level):
debug3(7526): monitor_read: checking request 156
debug3(7526): mm_answer_consolekit_register entering
debug1(7526): session_by_tty: session 0 tty /dev/pts/1
debug1(7573): server_input_channel_req: channel 2 request pty-req reply 1
debug1(7573): session_by_channel: session 2 channel 2
debug1(7573): session_input_channel_req: session 2 req pty-req
debug1(7573): Allocating pty.
debug3(7573): mm_request_send entering: type 28
debug3(7573): mm_pty_allocate: waiting for MONITOR_ANS_PTY
debug3(7573): mm_request_receive_expect entering: type 29
debug3(7573): mm_request_receive entering
debug1(7526): Unable to open session: The name org.freedesktop.ConsoleKit was 
not provided by any .service files
debug3(7526): mm_request_send entering: type 157
debug3(7526): mm_request_receive entering
debug3(7526): monitor_read: checking request 28
debug3(7526): mm_answer_pty entering
debug2(7526): session_new: allocate (allocated 2 max 10)
debug3(7526): session_unused: session id 2 unused
debug1(7526): session_new: session 2
mm_request_receive_expect: read: rtype 157 != type 29

>From the log, it looks as if two processes use the same set of pipes to
communicate to the monitor, one of them is sending
MONITOR_REQ_CONSOLEKIT_REGISTER, while another  MONITOR_REQ_PTY, and
because they use same set of pipes, and because both processes use same
pipe FDs, monitor reply is sometimes delivered to the wrong process.

I can reproduce the failure 90% of time using attached app, which expects first 
argument to be host name, second - login and the third - password, that are 
defaulted to ubuntu:ubuntu@localhost:
$ ./ssh-multisession 
Connecting to localhost...Done!
Authenticating as ubuntu...Done.
Starting channel 0
Starting channel 1
ssh_channel_request_pty()=-1: Socket error: disconnected
Starting channel 2
ssh_channel_open_session()=-1: Writing packet: error on socket (or connection 
closed): Operation now in progress
Starting channel 3

The same script works fine if sshd is compiled without consolekit.patch:
./ssh-multisession debian-host debian debian
Connecting to 172.17.162.237...Done!
Authenticating as debian...Done.
Starting channel 0
Starting channel 1
Starting channel 2
Starting channel 3
Starting channel 4
Starting channel 5
Starting channel 6
Starting channel 7
Starting channel 8
Starting channel 9

P.S. To compile a test app one needs to have libssh-dev package
installed on your system.

** Affects: openssh (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Small app that opens ssh connection and creates 10 
channels"
   
https://bugs.launchpad.net/bugs/1334916/+attachment/4140102/+files/ssh-multisession.c

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to openssh in Ubuntu.
https://bugs.launchpad.net/bugs/1334916

Title:
  sshd-ConsoleKit integration patch causes abrupt termination of
  multichannel sessions

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1334916/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to