]> granicus.if.org Git - apache/commitdiff
Fix segfault when restarting worker MPM. We can not examine the POD as
authorJustin Erenkrantz <jerenkrantz@apache.org>
Sat, 8 Dec 2001 01:38:05 +0000 (01:38 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Sat, 8 Dec 2001 01:38:05 +0000 (01:38 +0000)
a normal listener.

There was an additional bug than what Ian submitted to fix listen.c
(i.e. check sa for null): make_pipe_of_death does not zero out
lr->bind_addr (since it uses apr_palloc).  So, on Solaris, the first
time through, bind_addr was probably 0, but the second time, not (pools!).
(This caused Aaron's analysis that the patch worked the first time,
but not the second time.)

Submitted by: Ian Holsman
Reviewed by: Justin Erenkrantz, Aaron Bannert

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92387 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
server/listen.c
server/mpm/worker/worker.c

diff --git a/CHANGES b/CHANGES
index 366b3833ca88131fa03a029fa42c990285c5ab37..605f145ed2bb26583a18b1725810718c1d5907d7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.30-dev
 
+  *) Fix segfault when worker MPM receives SIGHUP.
+     [Ian Holsman, Aaron Bannert, Justin Erenkrantz]
+
   *) Fix bug that could potentially prevent the perchild MPM from
      working with more than one vhost/uid.  [Aaron Bannert]
 
diff --git a/STATUS b/STATUS
index 7ea6afcd7f78f22a279ca0c8cffa2999ca1111fa..23e54ec42d1c14657279a7461998a7c3c471aab6 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                             -*-text-*-
-Last modified at [$Date: 2001/12/07 18:10:25 $]
+Last modified at [$Date: 2001/12/08 01:38:04 $]
 
 Release:
 
@@ -92,12 +92,6 @@ RELEASE SHOWSTOPPERS:
       any) to segfault on AIX and can probably cause load or other
       errors on some other platforms.
 
-    * Sending httpd a SIGHUP with worker MPM causes a segfault 
-      when we started as root and switch to a different user.
-        Aaron Says: I've only been able to reproduce this on
-                    Solaris, works fine for Linux. Also, it appears
-                    to be happening in the parent.
-
 RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
 
     * There is increasing demand from module writers for an API
index a8a5ab575b2133ebe09e83beb547a70c5dc170c2..4f16276dfb486bdbcd98c617c6f2c6b95cbfcd73 100644 (file)
@@ -237,15 +237,18 @@ static void alloc_listener(process_rec *process, char *addr, apr_port_t port)
     /* see if we've got an old listener for this address:port */
     for (walk = &old_listeners; *walk; walk = &(*walk)->next) {
         sa = (*walk)->bind_addr;
-        apr_sockaddr_port_get(&oldport, sa);
-        apr_sockaddr_ip_get(&oldaddr, sa);
-        if (!strcmp(oldaddr, addr) && port == oldport) {
-            /* re-use existing record */
-            new = *walk;
-            *walk = new->next;
-            new->next = ap_listeners;
-            ap_listeners = new;
-            return;
+        /* Some listeners are not real so they will not have a bind_addr. */
+        if (sa) {
+            apr_sockaddr_port_get(&oldport, sa);
+            apr_sockaddr_ip_get(&oldaddr, sa);
+            if (!strcmp(oldaddr, addr) && port == oldport) {
+                /* re-use existing record */
+                new = *walk;
+                *walk = new->next;
+                new->next = ap_listeners;
+                ap_listeners = new;
+                return;
+            }
         }
     }
 
index 339315d48ad6c2e2d97c36c07e4bfbea9b4d69e3..69d1f8a61e2d10e92df264c791f38ae082a9894e 100644 (file)
@@ -1269,6 +1269,8 @@ static void make_pipe_of_death(int *num_listeners, apr_pool_t *p)
     lr->sd = sd;
     lr->active = 1;
     lr->accept_func = check_pipe_of_death;
+    /* We are not bound to a real address.  So, indicate that. */
+    lr->bind_addr = 0;
     lr->next = ap_listeners;
     ap_listeners = lr;
     (*num_listeners)++;