bin/64198: init(8) may keep zombies

Eugene Grosbein eugen at grosbein.pp.ru
Fri Mar 12 23:40:01 PST 2004


>Number:         64198
>Category:       bin
>Synopsis:       init(8) may keep zombies
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 12 23:40:00 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Eugene Grosbein
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Svyaz Service JSC
>Environment:
System: FreeBSD www.svzserv.kemerovo.su 4.9-STABLE FreeBSD 4.9-STABLE #4: Wed Mar 3 12:48:22 KRAT 2004 eu at www.svzserv.kemerovo.su:/home4/obj/home/src/sys/WWW i386

>Description:

	ttys(5) provides a way to run an application before starting main
	process for terminal line. One can use 'window="..."' for it.
	
	Let's look how init(8) impelents this:
	
	1. It forks to serve a line, obtains PID1.
	2. It forks again and executes a command written as window argument,
	   if needed. It obtains PID2.
	3. It sleeps for WINDOW_WAIT == 3 seconds.
	3. It executes main process for terminal line. This process will have
	   PID1 and PID2 will be a child of PID1.

	PID2 may become a zombie until PID1 finishes if PID2
	finishes during the stage 3. init(8) will not call waitpid()
	in this case.

>How-To-Repeat:

	1. Make user 'systat' and make the following shell script
	for its login shell:

#!/bin/sh
exec nice -10 systat -vm 3

	2. Add a record to /etc/gettytab:

systat|autologin systat display:\
	:al=systat:tc=Pc:

	3. Make a record in /etc/ttys:

ttyv9	"/usr/libexec/getty systat" cons25 on secure window="/bin/stty susp undef stop undef kill undef quit undef"

	4. Make init reread /etc/ttys: kill -1 1
	5. Look at stty zombie.

>Fix:

	Teach init(8) to call waitpid() even if a child is not found by
	the find_session() function.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list