2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

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.
This commit is contained in:
Ondřej Surý
2022-02-23 09:12:51 +01:00
parent be5be5aa39
commit 92cce1da65

View 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);
}