From 8ab39c8ee0a67248967e885e763afddb314cb0df Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 6 Jul 2018 17:03:22 +0100 Subject: [PATCH] add per-request memory leak fix (upstream r1833014) --- httpd-2.4.33-r1833841.patch | 59 +++++++++++++++++++++++++++++++++++++ httpd.spec | 7 ++++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 httpd-2.4.33-r1833841.patch diff --git a/httpd-2.4.33-r1833841.patch b/httpd-2.4.33-r1833841.patch new file mode 100644 index 0000000..749d67f --- /dev/null +++ b/httpd-2.4.33-r1833841.patch @@ -0,0 +1,59 @@ +# ./pullrev.sh 1833841 +http://svn.apache.org/viewvc?view=revision&revision=1833841 + +--- httpd-2.4.33/modules/http/http_request.c ++++ httpd-2.4.33/modules/http/http_request.c +@@ -345,6 +345,16 @@ + return rv; + } + ++#define RETRIEVE_BRIGADE_FROM_POOL(bb, key, pool, allocator) do { \ ++ apr_pool_userdata_get((void **)&bb, key, pool); \ ++ if (bb == NULL) { \ ++ bb = apr_brigade_create(pool, allocator); \ ++ apr_pool_userdata_setn((const void *)bb, key, NULL, pool); \ ++ } \ ++ else { \ ++ apr_brigade_cleanup(bb); \ ++ } \ ++} while(0) + + AP_DECLARE(void) ap_process_request_after_handler(request_rec *r) + { +@@ -357,7 +367,8 @@ + * this bucket is destroyed, the request will be logged and + * its pool will be freed + */ +- bb = apr_brigade_create(c->pool, c->bucket_alloc); ++ RETRIEVE_BRIGADE_FROM_POOL(bb, "ap_process_request_after_handler_brigade", ++ c->pool, c->bucket_alloc); + b = ap_bucket_eor_create(c->bucket_alloc, r); + APR_BRIGADE_INSERT_HEAD(bb, b); + +@@ -383,7 +394,7 @@ + */ + rv = ap_check_pipeline(c, bb, DEFAULT_LIMIT_BLANK_LINES); + c->data_in_input_filters = (rv == APR_SUCCESS); +- apr_brigade_destroy(bb); ++ apr_brigade_cleanup(bb); + + if (c->cs) + c->cs->state = (c->aborted) ? CONN_STATE_LINGER +@@ -477,7 +488,8 @@ + ap_process_async_request(r); + + if (!c->data_in_input_filters) { +- bb = apr_brigade_create(c->pool, c->bucket_alloc); ++ RETRIEVE_BRIGADE_FROM_POOL(bb, "ap_process_request_brigade", ++ c->pool, c->bucket_alloc); + b = apr_bucket_flush_create(c->bucket_alloc); + APR_BRIGADE_INSERT_HEAD(bb, b); + rv = ap_pass_brigade(c->output_filters, bb); +@@ -490,6 +502,7 @@ + ap_log_cerror(APLOG_MARK, APLOG_INFO, rv, c, APLOGNO(01581) + "flushing data to the client"); + } ++ apr_brigade_cleanup(bb); + } + if (ap_extended_status) { + ap_time_process_request(c->sbh, STOP_PREQUEST); diff --git a/httpd.spec b/httpd.spec index 5543eae..f7e0765 100644 --- a/httpd.spec +++ b/httpd.spec @@ -13,7 +13,7 @@ Summary: Apache HTTP Server Name: httpd Version: 2.4.33 -Release: 7%{?dist} +Release: 8%{?dist} URL: https://httpd.apache.org/ Source0: https://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2 Source1: index.html @@ -80,6 +80,7 @@ Patch36: httpd-2.4.33-r1830819+.patch Patch58: httpd-2.4.33-r1738878.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1564537 Patch59: httpd-2.4.33-sslmerging.patch +Patch60: httpd-2.4.33-r1833841.patch # Security fixes @@ -237,6 +238,7 @@ interface for storing and accessing per-user session data. %patch58 -p1 -b .r1738878 %patch59 -p1 -b .sslmerging +%patch60 -p1 -b .r1833841 # Patch in the vendor string sed -i '/^#define PLATFORM/s/Unix/%{vstring}/' os/unix/os.h @@ -728,6 +730,9 @@ exit $rv %{_rpmconfigdir}/macros.d/macros.httpd %changelog +* Fri Jul 6 2018 Joe Orton - 2.4.33-8 +- add per-request memory leak fix (upstream r1833014) + * Fri Jul 6 2018 Joe Orton - 2.4.33-7 - mod_ssl: add PKCS#11 cert/key support (Anderson Sasaki)