From: Yann Ylavic Date: Sun, 18 Apr 2021 17:04:34 +0000 (+0000) Subject: Merge r1882370 from trunk: X-Git-Tag: 2.4.47~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10eddf2f653cc1d48087bca4e4284f431f675814;p=thirdparty%2Fapache%2Fhttpd.git Merge r1882370 from trunk: Adjust signal handler before unblocking * server/mpm/event/event.c: Set the new signal handler before unblocking the signal as otherwise queued signals get delivered to the old handler immediately when the signal is unblocked. * server/mpm/worker/worker.c: Same thing as with event. Submitted by: rpluem Reviewed by: ylavic, jorton, icing git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1888917 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index f372068318d..f6ffa714e50 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.47 + *) MPM event/worker: Fix possible crash in child process on early signal + delivery. PR 64533. [Ruediger Pluem] + *) mod_http2: sync with github standalone version 1.15.17 - Log requests and sent the configured error response in case of early detected errors like too many or too long headers. [Ruediger Pluem] diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 18403cf97e9..6ba01576b05 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -1583,8 +1583,8 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) /* Unblock the signal used to wake this thread up, and set a handler for * it. */ - unblock_signal(LISTENER_SIGNAL); apr_signal(LISTENER_SIGNAL, dummy_signal_handler); + unblock_signal(LISTENER_SIGNAL); for (;;) { timer_event_t *te; @@ -2570,8 +2570,8 @@ static void child_main(int child_num_arg, int child_bucket) * the other threads in the process needs to take us down * (e.g., for MaxConnectionsPerChild) it will send us SIGTERM */ - unblock_signal(SIGTERM); apr_signal(SIGTERM, dummy_signal_handler); + unblock_signal(SIGTERM); /* Watch for any messages from the parent over the POD */ while (1) { rv = ap_mpm_podx_check(my_bucket->pod); diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index ccaeeba9ce5..d44190bb339 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -553,8 +553,8 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t *thd, void * dummy) /* Unblock the signal used to wake this thread up, and set a handler for * it. */ - unblock_signal(LISTENER_SIGNAL); apr_signal(LISTENER_SIGNAL, dummy_signal_handler); + unblock_signal(LISTENER_SIGNAL); /* TODO: Switch to a system where threads reuse the results from earlier poll calls - manoj */ @@ -748,8 +748,8 @@ static void * APR_THREAD_FUNC worker_thread(apr_thread_t *thd, void * dummy) SERVER_STARTING, NULL); #ifdef HAVE_PTHREAD_KILL - unblock_signal(WORKER_SIGNAL); apr_signal(WORKER_SIGNAL, dummy_signal_handler); + unblock_signal(WORKER_SIGNAL); #endif while (!workers_may_exit) { @@ -1230,8 +1230,8 @@ static void child_main(int child_num_arg, int child_bucket) * the other threads in the process needs to take us down * (e.g., for MaxConnectionsPerChild) it will send us SIGTERM */ - unblock_signal(SIGTERM); apr_signal(SIGTERM, dummy_signal_handler); + unblock_signal(SIGTERM); /* Watch for any messages from the parent over the POD */ while (1) { rv = ap_mpm_podx_check(my_bucket->pod);