]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Don't block synchronous signals (e.g., SIGSEGV) while waiting for
authorJeff Trawick <trawick@apache.org>
Fri, 9 May 2003 19:05:49 +0000 (19:05 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 9 May 2003 19:05:49 +0000 (19:05 +0000)
and holding a pthread accept mutex.

Reviewed by: Jim Jagielski, Bill Stoddard

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@99746 13f79535-47bb-0310-9956-ffa450edef68

src/CHANGES
src/main/http_main.c

index ca561c5fc3679e11a819244a8b861bdb9266c7ab..6f30080d5493118228d8a2083eb3443a674341c6 100644 (file)
@@ -1,5 +1,8 @@
 Changes with Apache 1.3.28
-  
+
+  *) Don't block synchronous signals (e.g., SIGSEGV) while waiting for
+     and holding a pthread accept mutex.  [Jeff Trawick]
+
   *) AIX: Change the default accept mechanism from pthread back to
      fcntl.  Idle child cleanup doesn't work when the child selected
      for termination by the parent is waiting on a pthread mutex, and 
index 586f68ed7036583c9c054ea059ad00fa145e6adf..dc0323a091486585ef45086b94357805bb790ce1 100644 (file)
@@ -650,6 +650,49 @@ static void accept_mutex_cleanup_pthread(void *foo)
     accept_mutex = (void *)(caddr_t)-1;
 }
 
+/* remove_sync_sigs() is from APR 0.9.4
+ *
+ * It is invalid to block synchronous signals, as such signals must
+ * be delivered on the thread that generated the original error
+ * (e.g., invalid storage reference).  Blocking them interferes
+ * with proper recovery.
+ */
+static void remove_sync_sigs(sigset_t *sig_mask)
+{
+#ifdef SIGABRT
+    sigdelset(sig_mask, SIGABRT);
+#endif
+#ifdef SIGBUS
+    sigdelset(sig_mask, SIGBUS);
+#endif
+#ifdef SIGEMT
+    sigdelset(sig_mask, SIGEMT);
+#endif
+#ifdef SIGFPE
+    sigdelset(sig_mask, SIGFPE);
+#endif
+#ifdef SIGILL
+    sigdelset(sig_mask, SIGILL);
+#endif
+#ifdef SIGIOT
+    sigdelset(sig_mask, SIGIOT);
+#endif
+#ifdef SIGPIPE
+    sigdelset(sig_mask, SIGPIPE);
+#endif
+#ifdef SIGSEGV
+    sigdelset(sig_mask, SIGSEGV);
+#endif
+#ifdef SIGSYS
+    sigdelset(sig_mask, SIGSYS);
+#endif
+#ifdef SIGTRAP
+    sigdelset(sig_mask, SIGTRAP);
+#endif
+
+/* APR logic to remove SIGUSR2 not copied */
+}
+
 static void accept_mutex_init_pthread(pool *p)
 {
     pthread_mutexattr_t mattr;
@@ -689,6 +732,7 @@ static void accept_mutex_init_pthread(pool *p)
     sigdelset(&accept_block_mask, SIGHUP);
     sigdelset(&accept_block_mask, SIGTERM);
     sigdelset(&accept_block_mask, SIGUSR1);
+    remove_sync_sigs(&accept_block_mask);
     ap_register_cleanup(p, NULL, accept_mutex_cleanup_pthread, ap_null_cleanup);
 }