From: Jeff Trawick Date: Fri, 9 May 2003 19:05:49 +0000 (+0000) Subject: Don't block synchronous signals (e.g., SIGSEGV) while waiting for X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=217cb8dbaf207e18b739c9c98d605f4d552cf57a;p=thirdparty%2Fapache%2Fhttpd.git Don't block synchronous signals (e.g., SIGSEGV) while waiting for 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 --- diff --git a/src/CHANGES b/src/CHANGES index ca561c5fc36..6f30080d549 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -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 diff --git a/src/main/http_main.c b/src/main/http_main.c index 586f68ed703..dc0323a0914 100644 --- a/src/main/http_main.c +++ b/src/main/http_main.c @@ -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); }