only enable RTLD_DEEPBIND if $APR_DEEPBIND is set

This commit is contained in:
Joe Orton 2020-06-16 17:11:47 +01:00
parent b3b8f2e062
commit f5eb58b5e4
2 changed files with 21 additions and 5 deletions

View File

@ -4,12 +4,25 @@ inside httpd. Use RTLD_DEEPBIND by default.
--- apr-1.7.0/dso/unix/dso.c.deepbind
+++ apr-1.7.0/dso/unix/dso.c
@@ -123,7 +123,7 @@
void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL);
@@ -38,6 +38,8 @@
#define DYLD_LIBRARY_HANDLE (void *)-1
#endif
+static int use_deepbind; /* 0 = unset, 1 = use DEEPBIND, -1, don't use DEEPBIND */
+
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
apr_os_dso_handle_t osdso,
apr_pool_t *pool)
@@ -125,6 +127,12 @@
#else
- int flags = RTLD_NOW | RTLD_GLOBAL;
+ int flags = RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND;
int flags = RTLD_NOW | RTLD_GLOBAL;
void *os_handle;
+
+ if (use_deepbind == 0)
+ use_deepbind = getenv("APR_DEEPBIND") != NULL ? 1 : -1;
+ if (use_deepbind == 1)
+ flags |= RTLD_DEEPBIND;
+
#ifdef _AIX
if (strchr(path + 1, '(') && path[strlen(path) - 1] == ')')
{

View File

@ -6,7 +6,7 @@
Summary: Apache Portable Runtime library
Name: apr
Version: 1.7.0
Release: 4%{?dist}
Release: 5%{?dist}
# ASL 2.0: everything
# ISC: network_io/apr-1.4.6/network_io/unix/inet_?to?.c
# BSD with advertising: strings/apr_snprintf.c, strings/apr_fnmatch.c,
@ -123,6 +123,9 @@ popd
%{_datadir}/aclocal/*.m4
%changelog
* Tue Jun 16 2020 Joe Orton <jorton@redhat.com> - 1.7.0-5
- only enable RTLD_DEEPBIND if $APR_DEEPBIND is set
* Wed Mar 4 2020 Joe Orton <jorton@redhat.com> - 1.7.0-4
- re-enable RTLD_DEEPBIND (#1739287)