]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Disable inactive handles caching when compiled with sanitizers
authorOndřej Surý <ondrej@isc.org>
Wed, 23 Feb 2022 08:12:51 +0000 (09:12 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 23 Feb 2022 22:21:29 +0000 (23:21 +0100)
When isc_nmhandle_t gets deactivated, it could be just put onto array
stack to be reused later to safe some initialization time.
Unfortunately, this might hide some use-after-free errors.

Disable the inactive handles caching when compiled with Address or
Thread Sanitizer.

lib/isc/netmgr/netmgr.c

index 0e8a4918316975403aece663399605e07ebb4efa..0c906e69b98dc146147c3e93a98c1251e804c10c 100644 (file)
@@ -1753,9 +1753,11 @@ nmhandle_deactivate(isc_nmsocket_t *sock, isc_nmhandle_t *handle) {
 
        INSIST(atomic_fetch_sub(&sock->ah, 1) > 0);
 
+#if !__SANITIZE_ADDRESS && !__SANITIZE_THREAD__
        if (atomic_load(&sock->active)) {
                reuse = isc_astack_trypush(sock->inactivehandles, handle);
        }
+#endif /* !__SANITIZE_ADDRESS && !__SANITIZE_THREAD__ */
        if (!reuse) {
                nmhandle_free(sock, handle);
        }