Package: bind9 / 1:9.21.10-4

0001-Disable-RTLD_DEEPBIND-in-Samba-DLZ-module.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From: =?utf-8?b?T25kxZllaiBTdXLDvQ==?= <ondrej@isc.org>
Date: Sat, 27 Jul 2024 04:57:36 +0200
Subject: Disable RTLD_DEEPBIND in Samba DLZ module

When RTLD_DEEPBIND is enabled in the LDB modules inside the Samba DLZ
plugin, and jemalloc is the BIND 9 memory allocator, there's a mismatch
in the used symbols and the LDB allocates memory using BIND 9
allocator (jemalloc), but frees the memory using RLTD_DEEPBIND free()
symbol from libc.  This causes assertion failure on BIND 9 startup.
---
 bin/named/dlz_dlopen_driver.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/bin/named/dlz_dlopen_driver.c b/bin/named/dlz_dlopen_driver.c
index 4906fad..f9e6bfb 100644
--- a/bin/named/dlz_dlopen_driver.c
+++ b/bin/named/dlz_dlopen_driver.c
@@ -211,6 +211,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
 	isc_mem_t *mctx = NULL;
 	isc_result_t result = ISC_R_FAILURE;
 	int r;
+	char buf[1024];
 
 	UNUSED(driverarg);
 
@@ -233,6 +234,24 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
 	/* Initialize the lock */
 	isc_mutex_init(&cd->lock);
 
+#if HAVE_JEMALLOC
+	/*
+	 * Disable RTLD_DEEPBIND in Samba DLZ module,
+	 * see https://bugzilla.samba.org/show_bug.cgi?id=15643
+	 * for more details.
+	 */
+	r = uv_os_getenv("LDB_MODULES_DISABLE_DEEPBIND", buf,
+			 &(size_t){ sizeof(buf) });
+	if (r == UV_ENOENT) {
+		r = uv_os_setenv("LDB_MODULES_DISABLE_DEEPBIND", "1");
+	}
+	if (r != 0) {
+		dlopen_log(ISC_LOG_WARNING,
+			   "setting LDB_MODULES_DISABLE_DEEPBIND failed: %s",
+			   uv_strerror(r));
+	}
+#endif
+
 	r = uv_dlopen(cd->dl_path, &cd->dl_handle);
 	if (r != 0) {
 		const char *errmsg = uv_dlerror(&cd->dl_handle);