]> 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 23:10:18 +0000 (00:10 +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.

(cherry picked from commit 92cce1da6571f9fe4b904667c822ab8ff0ebe4b2)

lib/isc/netmgr/netmgr.c

index 9cff4ee720623158db7e6aa1f5168b05213229f3..09d09161c9f2c8cd877f999b0dca5b1023198cdb 100644 (file)
@@ -1669,9 +1669,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);
        }