summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2003-08-21 13:45:05 +0000
committerhenning <henning@openbsd.org>2003-08-21 13:45:05 +0000
commit454966ddace84f36926ff8beb13b882c29787be4 (patch)
treea85661ad0f5b744b9e8af734bb29290061c8c78a
parent#include conf.h -> ap_config.h (diff)
downloadwireguard-openbsd-454966ddace84f36926ff8beb13b882c29787be4.tar.xz
wireguard-openbsd-454966ddace84f36926ff8beb13b882c29787be4.zip
apache bug #21737 ( http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21737)
introduced with 1.3.28: Apparently there has been a regression in 1.3.28 from 1.3.27 whereby CGI scripts are getting left around as zombies when suexec is in use, apparently because of a change in src/main/alloc.c that altered the behavior when sending SIGTERM to a child process. With suexec, the SIGTERM at line 2862 will fail not because the subprocess is dead already but because the httpd uid has no permission to term the cgi process, which is running as some other user. fix by Ralf S. Engelschall: That is, we don't have to check for the return value of ap_os_kill() and especially not check for ESRCH, because we _HAVE_ to waitpid() for it anyway (because it's our child and it either is already terminated and is waiting as a zombie for our waitpid() or it is still running). Under Unix it cannot be that a (non-detached in the sense of BSD's daemon(3)) child of a process just does no longer exists as long as the parent still exists and as long as the parent still has not done waitpid() for the child. So ESRCH cannot happen in our situation and the patch we currently use is fully sufficient. Both are at least portable enough for Unix, of course...
-rw-r--r--usr.sbin/httpd/src/main/alloc.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/usr.sbin/httpd/src/main/alloc.c b/usr.sbin/httpd/src/main/alloc.c
index 942f1759452..1373258458b 100644
--- a/usr.sbin/httpd/src/main/alloc.c
+++ b/usr.sbin/httpd/src/main/alloc.c
@@ -3096,12 +3096,8 @@ static void free_proc_chain(struct process_chain *procs)
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;
- }
+ ap_os_kill(p->pid, SIGTERM);
+ need_timeout = 1;
}
else if (p->kill_how == kill_always) {
kill(p->pid, SIGKILL);