Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 1996 03:15:29 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bugs@freebsd.org
Subject:   On speaking to the undead
Message-ID:  <199612191615.DAA16359@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
Should signals be sent (using kill()) to zombie processes or to
process groups containing only zombie processes?  I think so.

NIST-PCTS tests that signal 0 can be sent to zombie process groups.
Sending signal 0 is useful for detecting if the process [group]
has completely gone away.

Linux-2.0.27 allows sending all signals in both cases (at least
when the signals aren't blocked at process exit time and permission
is granted).  FreeBSD returns -1/ESRCH in all cases.

POSIX specifies that process lifetimes end when the process is
successfully waited for, and process group lifetimes end when all
all processes leave the group by ending their lifetime or changing
the group.  No special signal handling is specified for zombie
processes (POSIX calls them terminated processes [whose lifetime
hasn't ended]).  kill() is specified as returning ESRCH [only]
when no process or process group matching the pid can be found.
Thus the Linux behaviour is correct.

The FreeBSD implementation is also correct if FreeBSD "provides
extended security controls" :-).  Then it may impose further
implementation-defined restrictions on signals, including signal 0,
and it may deny the existence of some pids.  It's quite reasonable
to pretend that zombie pids don't exist.

Allowing signals to be sent to zombie process groups simply involves
removing the SZOMB check from killpg1().  It's harder to allow zombie
processes in kill().  pfind() can't see them because processes are
removed from the process hash table at exit() time.  pgfind() works
right because processes are removed from the process group hash table
at wait() time.

Bruce



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