bind9/bin
Michał Kępień 1313f06110 Move xmlInitThreads()/xmlCleanupThreads() calls
xmlInitThreads() and xmlCleanupThreads() are called from within
named_statschannels_configure() and named_statschannels_shutdown(),
respectively.  Both of these functions are executed by worker threads,
not the main named thread.  This causes ASAN to report memory leaks like
the following one upon shutdown (as long as named is asked to produce
any XML output over its configured statistics channels during its
lifetime):

    Direct leak of 968 byte(s) in 1 object(s) allocated from:
        #0 0x7f677c249cd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
        #1 0x7f677bc1838f in xmlGetGlobalState (/usr/lib/libxml2.so.2+0xa838f)

The data mentioned in the above report is a libxml2 state structure
stored as thread-specific data.  Such chunks of memory are automatically
released (by a destructor passed to pthread_key_create() by libxml2)
whenever a thread that allocated a given chunk exits.  However, if
xmlCleanupThreads() is called by a given thread before it exits, the
destructor will not be invoked (due to xmlCleanupThreads() calling
pthread_key_delete()) and ASAN will report a memory leak.  Thus,
xmlInitThreads() and xmlCleanupThreads() must not be called from worker
threads.  Since xmlInitThreads() must be called on Windows in order for
libxml2 to work at all, move xmlInitThreads() and xmlCleanupThreads()
calls to the main named thread (which does not produce any XML output
itself) in order to prevent the memory leak from being reported by ASAN.

(cherry picked from commit b425b5d56e)
2019-12-02 17:09:39 +01:00
..
check Fix hang in named-compilezone | head 2019-10-30 10:52:22 +11:00
confgen Make VS solution upgrading unnecessary 2019-09-27 09:16:02 +02:00
delv alphabetise delv's usage. 2019-11-23 00:09:29 +11:00
dig Replace RUNTIME_CHECK(dns_name_copy(..., NULL)) with dns_name_copynf() 2019-10-04 14:08:26 +10:00
dnssec alphabetize command line switch 2019-11-19 20:44:21 +11:00
named Move xmlInitThreads()/xmlCleanupThreads() calls 2019-12-02 17:09:39 +01:00
nsupdate Replace RUNTIME_CHECK(dns_name_copy(..., NULL)) with dns_name_copynf() 2019-10-04 14:08:26 +10:00
pkcs11 Make VS solution upgrading unnecessary 2019-09-27 09:16:02 +02:00
plugins add a search for GeoIP2 libraries in configure 2019-06-27 16:25:28 -07:00
python explicitly convert byte to string 2019-03-06 20:41:09 -08:00
rndc Make VS solution upgrading unnecessary 2019-09-27 09:16:02 +02:00
tests Fix the UID switch test to work with PKCS#11 build 2019-11-27 17:14:53 +00:00
tools Make VS solution upgrading unnecessary 2019-09-27 09:16:02 +02:00
win32/BINDInstall Make VS solution upgrading unnecessary 2019-09-27 09:16:02 +02:00
Makefile.in name change from "hook modules" to "plugins" 2018-12-06 10:36:50 -08:00