Subject: pkg/23137: CGI process might remain zombie on apache 1.3.28
To: None <gnats-bugs@gnats.netbsd.org>
From: Takahiro Kambe <taca@back-street.net>
List: netbsd-bugs
Date: 10/12/2003 23:26:48
>Number:         23137
>Category:       pkg
>Synopsis:       CGI process might remain zombie on apache 1.3.28
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 12 14:27:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Takahiro Kambe
>Release:        NetBSD 1.6ZC
>Organization:
Takahiro Kambe
>Environment:
	
	
System: NetBSD edge.back-street.net 1.6ZC NetBSD 1.6ZC (CF-R1) #30: Sat Oct 11 11:06:07 JST 2003 taca@edge.back-street.net:/var/obj/i386/sys/arch/i386/compile/CF-R1 i386
Architecture: i386
Machine: i386
>Description:
	Due to a bug of apache 1.3.28, CGI process remains zombie process
	when the CGI process run as another UID from httpd daemon.
>How-To-Repeat:
	Run CGI with suexec or some setuid wrapper.
>Fix:
	It is already fixed in CVS repogitry of apache.
	So, apply this patch.


===================================================================
RCS file: /home/cvspublic/apache-1.3/src/main/alloc.c,v
retrieving revision 1.145
retrieving revision 1.147
diff -u -r1.145 -r1.147
--- apache-1.3/src/main/alloc.c	2003/06/20 15:05:40	1.145
+++ apache-1.3/src/main/alloc.c	2003/09/05 12:27:30	1.147
@@ -2858,13 +2858,14 @@
     for (p = procs; p; p = p->next) {
 	if ((p->kill_how == kill_after_timeout)
 	    || (p->kill_how == kill_only_once)) {
-	    /* Subprocess may be dead already.  Only need the timeout if not. */
-	    if (ap_os_kill(p->pid, SIGTERM) == -1) {
-                p->kill_how = kill_never;
-            }
-            else {
-		need_timeout = 1;
-            }
+	    /*
+	     * This is totally bogus, but seems to be the
+	     * only portable (as in reliable) way to accomplish
+	     * this. Note that this implies an unavoidable
+	     * delay.
+	     */
+	    ap_os_kill(p->pid, SIGTERM);
+	    need_timeout = 1;
 	}
 	else if (p->kill_how == kill_always) {
 	    kill(p->pid, SIGKILL);

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