mirror of
https://github.com/apache/httpd.git
synced 2025-10-28 20:34:59 +03:00
core, MPMs unix: follow up to r1809881.
Deregister all hooks first (in pre_cleanup), by doing it last we could still have had them run when DSOs were unloaded. Likewise, avoid double faults when handling fatal signals by restoring the default handler before pconf is cleared (we can't ap_log_error there). Finally, we need to ignore sig_term/restart (do nothing) when the main process is exiting (i.e. ap_pglobal is destroyed), since retained_data are freed. Aimed to fix all faults in PR 61558. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1809973 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1009,6 +1009,33 @@ AP_DECLARE(apr_status_t) ap_fatal_signal_child_setup(server_rec *s)
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
/* We can't call sig_coredump (ap_log_error) once pconf is destroyed, so
|
||||
* avoid double faults by restoring each default signal handler on cleanup.
|
||||
*/
|
||||
static apr_status_t fatal_signal_cleanup(void *unused)
|
||||
{
|
||||
(void)unused;
|
||||
|
||||
apr_signal(SIGSEGV, SIG_DFL);
|
||||
#ifdef SIGBUS
|
||||
apr_signal(SIGBUS, SIG_DFL);
|
||||
#endif /* SIGBUS */
|
||||
#ifdef SIGABORT
|
||||
apr_signal(SIGABORT, SIG_DFL);
|
||||
#endif /* SIGABORT */
|
||||
#ifdef SIGABRT
|
||||
apr_signal(SIGABRT, SIG_DFL);
|
||||
#endif /* SIGABRT */
|
||||
#ifdef SIGILL
|
||||
apr_signal(SIGILL, SIG_DFL);
|
||||
#endif /* SIGILL */
|
||||
#ifdef SIGFPE
|
||||
apr_signal(SIGFPE, SIG_DFL);
|
||||
#endif /* SIGFPE */
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s,
|
||||
apr_pool_t *in_pconf)
|
||||
{
|
||||
@@ -1071,6 +1098,8 @@ AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s,
|
||||
|
||||
pconf = in_pconf;
|
||||
parent_pid = my_pid = getpid();
|
||||
apr_pool_cleanup_register(pconf, NULL, fatal_signal_cleanup,
|
||||
fatal_signal_cleanup);
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user