From: Ondřej Surý Date: Wed, 23 Feb 2022 08:12:51 +0000 (+0100) Subject: Disable inactive handles caching when compiled with sanitizers X-Git-Tag: v9.16.27~9^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55780afdb9e083426c824ae163430354cfa9e0c0;p=thirdparty%2Fbind9.git Disable inactive handles caching when compiled with sanitizers 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) --- diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 9cff4ee7206..09d09161c9f 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -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); }