Subject: bin/26528: sshd leaves disconnected processes running
To: None <gnats-bugs@gnats.netbsd.org>
From: Darrin B. Jewell <dbj@netbsd.org>
List: netbsd-bugs
Date: 08/02/2004 23:35:53
>Number:         26528
>Category:       bin
>Synopsis:       sshd leaves disconnected processes running
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 03 03:38:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Darrin B. Jewell
>Release:        NetBSD 2.0
>Organization:
>Environment:

$ hostname
babylon5.netbsd.org
$ uname -a
NetBSD babylon5.netbsd.org 2.0_BETA NetBSD 2.0_BETA (NBFTP) #2: Thu Jul 22 15:21:08 UTC 2004  soda@ADMIN:/usr/src/sys/arch/i386/compile/NBFTP i386
$ ident /usr/sbin/sshd
/usr/sbin/sshd:
     $OpenBSD: sshd.c,v 1.263 2003/02/16 17:09:57 markus Exp $
     $OpenBSD: auth-rhosts.c,v 1.28 2002/05/13 21:26:49 markus Exp $
     $OpenBSD: auth-passwd.c,v 1.27 2002/05/24 16:45:16 stevesk Exp $
     $OpenBSD: auth-rsa.c,v 1.56 2002/06/10 16:53:06 stevesk Exp $
     $OpenBSD: auth-rh-rsa.c,v 1.34 2002/03/25 09:25:06 markus Exp $
     $OpenBSD: sshpty.c,v 1.8 2003/02/03 08:56:16 markus Exp $
     $OpenBSD: sshlogin.c,v 1.5 2002/08/29 15:57:25 stevesk Exp $
     $OpenBSD: servconf.c,v 1.116 2003/02/21 09:05:53 markus Exp $
     $OpenBSD: serverloop.c,v 1.107 2003/04/02 09:48:07 markus Exp $
     $OpenBSD: uidswap.c,v 1.23 2002/07/15 17:15:31 stevesk Exp $
     $OpenBSD: auth.c,v 1.46 2002/11/04 10:07:53 markus Exp $
     $OpenBSD: auth1.c,v 1.47 2003/02/06 21:22:42 markus Exp $
     $OpenBSD: auth2.c,v 1.98 2003/05/14 02:15:47 markus Exp $
     $OpenBSD: auth-options.c,v 1.26 2002/07/30 17:03:55 markus Exp $
     $OpenBSD: session.c,v 1.154 2003/03/05 22:33:43 markus Exp $
     $OpenBSD: auth-chall.c,v 1.8 2001/05/18 14:13:28 markus Exp $
     $OpenBSD: auth2-chall.c,v 1.20 2002/06/30 21:59:45 deraadt Exp $
     $OpenBSD: groupaccess.c,v 1.5 2002/03/04 17:27:39 stevesk Exp $
     $OpenBSD: auth-skey.c,v 1.20 2002/06/30 21:59:45 deraadt Exp $
     $OpenBSD: auth-bsdauth.c,v 1.5 2002/06/30 21:59:45 deraadt Exp $
     $OpenBSD: auth2-hostbased.c,v 1.2 2002/05/31 11:35:15 markus Exp $
     $OpenBSD: auth2-kbdint.c,v 1.2 2002/05/31 11:35:15 markus Exp $
     $OpenBSD: auth2-none.c,v 1.4 2002/06/27 10:35:47 deraadt Exp $
     $OpenBSD: auth2-passwd.c,v 1.2 2002/05/31 11:35:15 markus Exp $
     $OpenBSD: auth2-pubkey.c,v 1.2 2002/05/31 11:35:15 markus Exp $
     $OpenBSD: monitor_mm.c,v 1.8 2002/08/02 14:43:15 millert Exp $
     $OpenBSD: monitor.c,v 1.39 2003/05/14 02:15:47 markus Exp $
     $OpenBSD: monitor_wrap.c,v 1.26 2003/04/07 08:29:57 markus Exp $
     $OpenBSD: monitor_fdpass.c,v 1.4 2002/06/26 14:50:04 deraadt Exp $
     $OpenBSD: kexdhs.c,v 1.1 2003/02/16 17:09:57 markus Exp $
     $OpenBSD: kexgexs.c,v 1.1 2003/02/16 17:09:57 markus Exp $
     $OpenBSD: auth-krb5.c,v 1.10 2002/11/21 23:03:51 deraadt Exp $
     $OpenBSD: auth2-krb5.c,v 1.2 2003/05/15 14:09:21 markus Exp $
     $OpenBSD: auth-krb4.c,v 1.29 2003/02/21 10:34:48 mpech Exp $
     $OpenBSD: radix.c,v 1.22 2002/09/09 14:54:15 markus Exp $
     $OpenBSD: kexgex.c,v 1.23 2003/02/16 17:09:57 markus Exp $
     $OpenBSD: kexdh.c,v 1.19 2003/02/16 17:09:57 markus Exp $
     $OpenBSD: dh.c,v 1.23 2002/11/21 22:22:50 markus Exp $
     $OpenBSD: ttymodes.c,v 1.18 2002/06/19 00:27:55 deraadt Exp $
     $OpenBSD: tildexpand.c,v 1.13 2002/06/23 03:25:50 deraadt Exp $
     $OpenBSD: mpaux.c,v 1.16 2001/02/08 19:30:52 itojun Exp $
     $OpenBSD: hostfile.c,v 1.30 2002/07/24 16:11:18 markus Exp $
     $OpenBSD: authfile.c,v 1.53 2003/05/11 16:56:48 markus Exp $
     $OpenBSD: rsa.c,v 1.24 2001/12/27 18:22:16 markus Exp $
     $OpenBSD: kex.c,v 1.55 2003/04/01 10:31:26 markus Exp $
     $OpenBSD: dispatch.c,v 1.15 2002/01/11 13:39:36 markus Exp $
     $OpenBSD: xmalloc.c,v 1.16 2001/07/23 18:21:46 stevesk Exp $
     $OpenBSD: packet.c,v 1.105 2003/04/02 09:48:07 markus Exp $
     $OpenBSD: mac.c,v 1.5 2002/05/16 22:02:50 markus Exp $
     $OpenBSD: deattack.c,v 1.18 2002/03/04 17:27:39 stevesk Exp $
     $OpenBSD: compress.c,v 1.19 2002/03/18 17:31:54 provos Exp $
     $OpenBSD: cipher.c,v 1.62 2002/11/21 22:45:31 markus Exp $
     $OpenBSD: nchan.c,v 1.47 2002/06/19 00:27:55 deraadt Exp $
     $OpenBSD: channels.c,v 1.187 2003/03/05 22:33:43 markus Exp $
     $OpenBSD: canohost.c,v 1.35 2002/11/26 02:38:54 stevesk Exp $
     $OpenBSD: authfd.c,v 1.58 2003/01/23 13:50:27 markus Exp $
     $OpenBSD: misc.c,v 1.20 2002/12/13 10:03:15 markus Exp $
     $OpenBSD: key.c,v 1.51 2003/02/12 09:33:04 markus Exp $
     $OpenBSD: atomicio.c,v 1.10 2001/05/08 22:48:07 markus Exp $
     $OpenBSD: ssh-rsa.c,v 1.28 2003/02/12 09:33:04 markus Exp $
     $OpenBSD: ssh-dss.c,v 1.18 2003/02/12 09:33:04 markus Exp $
     $OpenBSD: uuencode.c,v 1.16 2002/09/09 14:54:15 markus Exp $
     $OpenBSD: compat.c,v 1.66 2003/04/01 10:31:26 markus Exp $
     $OpenBSD: bufaux.c,v 1.28 2002/10/23 10:40:16 markus Exp $
     $OpenBSD: match.c,v 1.19 2002/03/01 13:12:10 markus Exp $
     $OpenBSD: buffer.c,v 1.16 2002/06/26 08:54:18 markus Exp $
     $OpenBSD: log.c,v 1.25 2003/01/11 18:29:43 markus Exp $
     $OpenBSD: fatal.c,v 1.1 2002/02/22 12:20:34 markus Exp $
     $NetBSD: crt0.c,v 1.13 2003/07/26 19:24:27 salo Exp $
     $NetBSD: sshd.c,v 1.34 2003/07/24 15:31:56 itojun Exp $
     $NetBSD: auth-rhosts.c,v 1.14 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth-passwd.c,v 1.10 2003/07/24 15:31:52 itojun Exp $
     $NetBSD: auth-rsa.c,v 1.3 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth-rh-rsa.c,v 1.3 2003/07/10 01:09:41 lukem Exp $
     $NetBSD: sshpty.c,v 1.10 2003/07/10 01:09:49 lukem Exp $
     $NetBSD: sshlogin.c,v 1.12 2003/08/26 16:48:34 wiz Exp $
     $NetBSD: servconf.c,v 1.27 2003/12/11 09:46:26 dyoung Exp $
     $NetBSD: serverloop.c,v 1.22 2003/07/10 01:09:46 lukem Exp $
     $NetBSD: uidswap.c,v 1.2 2003/07/10 01:09:49 lukem Exp $
     $NetBSD: auth.c,v 1.20 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth1.c,v 1.25 2003/07/24 15:31:53 itojun Exp $
     $NetBSD: auth2.c,v 1.23 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth-options.c,v 1.3 2003/07/10 01:09:41 lukem Exp $
     $NetBSD: session.c,v 1.35 2003/09/17 23:19:02 christos Exp $
     $NetBSD: auth-chall.c,v 1.6 2003/07/10 01:09:41 lukem Exp $
     $NetBSD: auth2-chall.c,v 1.12 2003/09/08 21:00:41 itojun Exp $
     $NetBSD: groupaccess.c,v 1.6 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: auth-skey.c,v 1.10 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth-bsdauth.c,v 1.6 2003/07/10 01:09:41 lukem Exp $
     $NetBSD: auth2-hostbased.c,v 1.3 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth2-kbdint.c,v 1.2 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth2-none.c,v 1.4 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth2-passwd.c,v 1.3 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth2-pubkey.c,v 1.3 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: monitor_mm.c,v 1.4 2003/07/10 01:09:45 lukem Exp $
     $NetBSD: monitor.c,v 1.15 2003/07/24 15:31:53 itojun Exp $
     $NetBSD: monitor_wrap.c,v 1.12 2003/07/24 15:31:53 itojun Exp $
     $NetBSD: monitor_fdpass.c,v 1.3 2003/07/10 01:09:45 lukem Exp $
     $NetBSD: kexdhs.c,v 1.2 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: kexgexs.c,v 1.2 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: auth-krb5.c,v 1.14 2003/07/28 15:50:17 jwise Exp $
     $NetBSD: auth2-krb5.c,v 1.3 2003/07/10 01:09:42 lukem Exp $
     $NetBSD: auth-krb4.c,v 1.13 2003/07/24 15:31:52 itojun Exp $
     $NetBSD: radix.c,v 1.13 2003/07/24 15:31:53 itojun Exp $
     $NetBSD: random.c,v 1.5 2002/05/25 00:29:52 itojun Exp $
     $NetBSD: kexgex.c,v 1.10 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: kexdh.c,v 1.9 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: dh.c,v 1.12 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: ttymodes.c,v 1.3 2003/07/10 01:09:49 lukem Exp $
     $NetBSD: tildexpand.c,v 1.7 2003/07/10 01:09:49 lukem Exp $
     $NetBSD: mpaux.c,v 1.5 2003/07/10 01:09:45 lukem Exp $
     $NetBSD: hostfile.c,v 1.11 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: authfile.c,v 1.18 2003/09/18 08:16:15 itojun Exp $
     $NetBSD: rsa.c,v 1.2 2003/07/10 01:09:46 lukem Exp $
     $NetBSD: kex.c,v 1.18 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: dispatch.c,v 1.3 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: xmalloc.c,v 1.7 2003/07/10 01:09:49 lukem Exp $
     $NetBSD: packet.c,v 1.21 2003/07/10 01:09:46 lukem Exp $
     $NetBSD: mac.c,v 1.6 2003/07/24 14:16:56 itojun Exp $
     $NetBSD: deattack.c,v 1.13 2003/09/17 23:19:02 christos Exp $
     $NetBSD: compress.c,v 1.8 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: cipher.c,v 1.15 2003/07/24 14:16:56 itojun Exp $
     $NetBSD: nchan.c,v 1.3 2003/07/10 01:09:45 lukem Exp $
     $NetBSD: channels.c,v 1.30 2003/09/16 23:16:59 christos Exp $
     $NetBSD: canohost.c,v 1.17 2003/07/10 01:09:43 lukem Exp $
     $NetBSD: authfd.c,v 1.16 2003/07/10 01:09:43 lukem Exp $
     $NetBSD: misc.c,v 1.14 2003/09/18 01:41:56 christos Exp $
     $NetBSD: key.c,v 1.19 2003/07/10 01:09:45 lukem Exp $
     $NetBSD: atomicio.c,v 1.6 2003/07/10 01:09:41 lukem Exp $
     $NetBSD: ssh-rsa.c,v 1.14 2003/07/10 01:09:48 lukem Exp $
     $NetBSD: ssh-dss.c,v 1.13 2003/07/10 01:09:47 lukem Exp $
     $NetBSD: uuencode.c,v 1.8 2003/07/10 01:09:49 lukem Exp $
     $NetBSD: compat.c,v 1.4 2003/07/10 01:09:44 lukem Exp $
     $NetBSD: bufaux.c,v 1.4 2003/07/10 01:09:43 lukem Exp $
     $NetBSD: match.c,v 1.2 2003/07/10 01:09:45 lukem Exp $
     $NetBSD: buffer.c,v 1.5 2003/09/18 08:16:40 itojun Exp $
     $NetBSD: log.c,v 1.7 2003/07/10 01:09:45 lukem Exp $
     $NetBSD: fatal.c,v 1.2 2003/07/10 01:09:44 lukem Exp $

>Description:

when I interrupt an ssh process, it leaves the process running
on the remote host.

>How-To-Repeat:

Start
  ssh ftp.netbsd.org dd if=/dev/zeero of=/dev/null
Then interrupt it.  A typical way to do this is with Ctrl-C.

Alternatively, run the following in /bin/sh

  ssh ftp.netbsd.org dd if=/dev/zero of=/dev/null & && sleep 10 && kill -INT $!

I notice that the problem occurs even when the process
is expecting input.  This problem was originally discovered
while interrupting a disk image restore which did

  ssh root@192.168.0.1 'gzip -d -c | dd of=/dev/rwd1d ibs=64k obs=64k' < img.gz

If you test this against a netbsd server, please be sure to kill
off your rogue processes!

>Fix:

Not sure.  Is this even a bug?  What about when keepalives is off and
the process is not doing any i/o?

>Release-Note:
>Audit-Trail:
>Unformatted: