]> git.ipfire.org Git - thirdparty/bind9.git/commit
Disable safe-guard assertion in DLL_THREAD_ATTACH/DLL_THREAD_DETACH
authorOndřej Surý <ondrej@isc.org>
Wed, 24 Feb 2021 05:55:36 +0000 (06:55 +0100)
committerOndřej Surý <ondrej@isc.org>
Fri, 26 Feb 2021 16:18:06 +0000 (17:18 +0100)
commit2011efa99dac5bbe2f557bcac1fb4e849f2b397b
treecbfe2738ecd1a43bf4fb8bd38e8e1969f163aadd
parent2f0f531ee837a410835182ce101bae54cf8e5f2d
Disable safe-guard assertion in DLL_THREAD_ATTACH/DLL_THREAD_DETACH

The BIND 9 libraries on Windows define DllMain() optional entry point
into a dynamic-link library (DLL).  When the system starts or terminates
a process or thread, it calls the entry-point function for each loaded
DLL using the first thread of the process.

When the DLL is being loaded into the virtual address space of the
current process as a result of the process starting up, we make a call
to DisableThreadLibraryCalls() which should disable the
DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the specified
dynamic-link library (DLL).

This seems not be the case because we never check the return value of
the DisableThreadLibraryCalls() call, and it could in fact fail.  The
DisableThreadLibraryCalls() function fails if the DLL specified by
hModule has active static thread local storage, or if hModule is an
invalid module handle.

In this commit, we remove the safe-guard assertion put in place for the
DLL_THREAD_ATTACH and DLL_THREAD_DETACH events and we just ignore them.
BIND 9 doesn't create/destroy enough threads for it actually to make any
difference, and in fact we do use static thread local storage in the
code.
lib/isc/win32/DLLMain.c