]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Disable inactive uvreqs caching when compiled with sanitizers
authorOndřej Surý <ondrej@isc.org>
Wed, 23 Feb 2022 23:14:26 +0000 (00:14 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 23 Feb 2022 23:16:31 +0000 (00:16 +0100)
When isc__nm_uvreq_t gets deactivated, it could be just put onto array
stack to be reused later to save some initialization time.
Unfortunately, this might hide some use-after-free errors.

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

(cherry picked from commit be339b3c8399bb6ccf8acd26edfbb721b9c7e256)

lib/isc/netmgr/netmgr.c

index 09d09161c9f2c8cd877f999b0dca5b1023198cdb..4829af52f9b70dc2d4bdf9357316ac78bdb9922b 100644 (file)
@@ -2384,10 +2384,14 @@ isc___nm_uvreq_put(isc__nm_uvreq_t **req0, isc_nmsocket_t *sock FLARG) {
        handle = req->handle;
        req->handle = NULL;
 
+#if !__SANITIZE_ADDRESS__ && !__SANITIZE_THREAD__
        if (!isc__nmsocket_active(sock) ||
            !isc_astack_trypush(sock->inactivereqs, req)) {
                isc_mem_put(sock->mgr->mctx, req, sizeof(*req));
        }
+#else  /* !__SANITIZE_ADDRESS__ && !__SANITIZE_THREAD__ */
+       isc_mem_put(sock->mgr->mctx, req, sizeof(*req));
+#endif /* !__SANITIZE_ADDRESS__ && !__SANITIZE_THREAD__ */
 
        if (handle != NULL) {
                isc__nmhandle_detach(&handle FLARG_PASS);