Commit d2e1889e8b for bind

commit d2e1889e8b22ca054442db1f5dec49e97c27b2c4
Author: Michal Nowak <mnowak@isc.org>
Date:   Tue Aug 11 10:49:14 2026 +0000

    Do not use jemalloc when a sanitizer is in use

    OSS-Fuzz supplies individual UBSan checks and can enable MSan
    externally, so allocator selection must recognize those configurations
    too.

    Assisted-by: Claude:claude-opus-5, AddressSanitizer
    Assisted-by: Codex:gpt-6

diff --git a/meson.build b/meson.build
index 000cb59c15..adf0cf61f4 100644
--- a/meson.build
+++ b/meson.build
@@ -63,7 +63,7 @@ fuzzing_opt = get_option('fuzzing')
 geoip_opt = get_option('geoip')
 gssapi_opt = get_option('gssapi')
 idn_opt = get_option('idn')
-jemalloc_opt = get_option('jemalloc').disable_auto_if(sanitizer != 'none')
+jemalloc_opt = get_option('jemalloc')
 leak_opt = get_option('leak-detection')
 line_opt = get_option('line')
 locktype_opt = get_option('locktype')
@@ -314,6 +314,8 @@ foreach name, feature : {
     'address': 'address_sanitizer',
     'leak': 'leak_sanitizer',
     'thread': 'thread_sanitizer',
+    'memory': 'memory_sanitizer',
+    'undefined': 'undefined_behavior_sanitizer',
 }
     sanitizer_probe = '''
 #ifndef __has_feature
@@ -332,6 +334,20 @@ endforeach
 asan_enabled = asan_enabled or compiler_sanitizers.contains('address')
 lsan_enabled = lsan_enabled or compiler_sanitizers.contains('leak')
 tsan_enabled = tsan_enabled or compiler_sanitizers.contains('thread')
+ubsan_enabled = ubsan_enabled or compiler_sanitizers.contains('undefined')
+msan_enabled = sanitizer.contains('memory') or compiler_sanitizers.contains('memory')
+
+# The sanitizers cannot see through jemalloc: allocations made by it are
+# invisible to LeakSanitizer, which then reports whatever it can no longer
+# reach through them, and AddressSanitizer stops checking most of the heap.
+jemalloc_opt = jemalloc_opt.disable_auto_if(
+    sanitizer != 'none'
+    or asan_enabled
+    or lsan_enabled
+    or tsan_enabled
+    or ubsan_enabled
+    or msan_enabled,
+)

 # Refer to sanitize.c.in for the justification
 config_sanitize = configuration_data()