[8.0p1] After the remote ssh command execution, the session does not terminate until an active disconnect

Hong Cho hongcho at gmail.com
Tue Aug 20 12:56:07 AEST 2019


Hi,

We recently upgraded OpenSSH from 7.5p1 to 8.0p1, and received a report
that there was a behavioral differences where the ssh session did not
disconnect after a remote background command execution. For example, "ssh
user at example.com 'tail -f /var/xxx &'

After looking at the debug logs and comparing the code, it seems there was
a bug in the portable version during the adaptation of the 1.367 change
(refactoring) of channels.c.

The OpenBSD version looks correct, but for the portable version, the exit
condition of channel_handle_efd_read() didn't get converted correctly, but
somehow got copy-and-pasted from the rfd version. I couldn't find the
change history for the portable version, so I can't when/how this happened.

This should make the "force" condition the same as before the refactoring
of the portable version of channels.c.

--- /tmp/tmp.48415.39   2019-08-19 19:24:29.000000000 -0700
+++ crypto/openssh/channels.c    2019-08-19 19:19:39.000000000 -0700
@@ -2103,7 +2103,15 @@ channel_handle_efd_read(struct ssh *ssh,
  ssize_t len;
  int r, force;

+ force = c->detach_close;
- force = c->isatty && c->detach_close && c->istate != CHAN_INPUT_CLOSED;

  if (c->efd == -1 || (!force && !FD_ISSET(c->efd, readset)))
        return 1;
---

Thanks.

Hong.


More information about the openssh-unix-dev mailing list