On a buggy kernel
while sh /usr/tests/bin/sh/builtins/kill1.0; do :; done
fails within a few seconds with
kill: %1: No such process
With the fix, it runs for minutes without failing.
A more direct test case is:
#include <sys/wait.h>
#include <err.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
pid_t child;
switch (child = fork()) {
case 0:
_exit(0);
case -1:
err(1, "fork");
default:
break;
}
if (waitid(P_PID, child, NULL, WEXITED | WNOWAIT) == -1)
err(1, "waitid");
if (kill(child, SIGTERM) == -1)
err(1, "kill zombie");
return 0;
}