Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2012 02:22:33 +1000
From:      Darren Reed <darrenr@freebsd.org>
To:        freebsd-net@freebsd.org
Subject:   rsh forking to infinity and beyond
Message-ID:  <4FC254C9.1050408@freebsd.org>

next in thread | raw e-mail | index | archive | help
I've run into a rather strange problem with rsh on FreeBSD 9.0
where rsh seems to become a fork bomb.

How or why this happens, I do not know. If I run it from the
command line with a shell, it behaves perfectly normal. Even
inside $() with pdksh. But when I put it in my script...

What does the problem look like? See below.

The script in question does this:
                x=$(truss -o rsh.$host.tr -f ${RSH} -l root ${host} echo hello_world)
...

Normally there would be no truss, but I'm trying to work out
why this is happening. Unfortunately, truss does not reveal
any amount of nested forking.

I'm at a loss to explain what's going on.

Anyone?

Darren

-+= 00001 root /sbin/init --
 |--= 00127 root adjkerntz -i
 |--= 00743 root /sbin/devd
 |--= 00909 root /usr/sbin/syslogd -s
 |-+= 01149 root /usr/sbin/sshd
 | \-+= 01255 root sshd: darrenr [priv] (sshd)
 |   \-+- 01258 darrenr sshd: darrenr@pts/0 (sshd)
 |     \-+= 01259 darrenr -tcsh (tcsh)
 |       \-+= 01328 root su root -c exec tcsh
 |         \-+= 01329 root tcsh
 |           |-+= 01392 root /bin/ksh ./setup.sh (ksh93)
 |           | \-+- 01394 root truss -o rsh.freebsd.tr -f rsh -l root freebsd ec
ho hello_world
 |           |   |-+- 01395 root rsh -l root freebsd echo hello_world
 |           |   | \--- 01454 root <defunct>
 |           |   |--- 01400 root <defunct>
 |           |   \--- 01455 root <defunct>
 |           \-+= 02045 root pstree
 |             \--- 02046 root ps -axwwo user,pid,ppid,pgid,command
 |--= 01156 root sendmail: accepting connections (sendmail)
 |--= 01160 smmsp sendmail: Queue runner@00:30:00 for /var/spool/clientmqueue (s
endmail)
 |--= 01166 root /usr/sbin/cron -s
 |--= 01191 root /usr/sbin/inetd -wW -C 60
 |--= 01226 root /usr/libexec/getty Pc ttyv0
 |--= 01227 root /usr/libexec/getty Pc ttyv1
 |--= 01228 root /usr/libexec/getty Pc ttyv2
 |--= 01229 root /usr/libexec/getty Pc ttyv3
 |--= 01230 root /usr/libexec/getty Pc ttyv4
 |--= 01231 root /usr/libexec/getty Pc ttyv5
 |--= 01232 root /usr/libexec/getty Pc ttyv6
 |--= 01233 root /usr/libexec/getty Pc ttyv7
 |-+- 01397 root rsh freebsd -l root echo hello_world
 | \--- 01401 root <defunct>
 |-+- 01399 root rsh freebsd -l root echo hello_world
 | \--- 01404 root <defunct>
 |-+- 01403 root rsh freebsd -l root echo hello_world
 | \--- 01407 root <defunct>
 |-+- 01406 root rsh freebsd -l root echo hello_world
 | \--- 01410 root <defunct>
 |-+- 01409 root rsh freebsd -l root echo hello_world
 | \--- 01413 root <defunct>
 |-+- 01412 root rsh freebsd -l root echo hello_world
 | \--- 01416 root <defunct>
 |-+- 01415 root rsh freebsd -l root echo hello_world
...
 |-+- 02026 root rsh freebsd -l root echo hello_world
 | \--- 02030 root <defunct>
 |-+- 02029 root rsh freebsd -l root echo hello_world
 | \--- 02033 root <defunct>
 |-+- 02032 root rsh freebsd -l root echo hello_world
 | \--- 02036 root <defunct>
 |-+- 02035 root rsh freebsd -l root echo hello_world
 | \--- 02039 root <defunct>
 \-+- 02038 root rsh freebsd -l root echo hello_world
   \-+- 02040 root rsh freebsd -l root echo hello_world
     \--- 02041 root rsh freebsd -l root echo hello_world





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FC254C9.1050408>