Move the isc_random API initialization to the thread_local variable

Instead of writing complicated wrappers for every thread, move the
initialization back to isc_random unit and check whether the random seed
was initialized with a thread_local variable.

Ensure that isc_entropy_get() returns a non-zero seed.

This avoids problems with thread sanitizer tests getting stuck in an
infinite loop.
This commit is contained in:
Ondřej Surý
2023-04-25 08:53:57 +02:00
parent e0248bf60f
commit 65021dbf52
6 changed files with 21 additions and 46 deletions

View File

@@ -26,7 +26,6 @@
#include "mem_p.h"
#include "mutex_p.h"
#include "os_p.h"
#include "random_p.h"
#ifndef ISC_CONSTRUCTOR
#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
@@ -46,7 +45,6 @@ isc__initialize(void) {
isc__os_initialize();
isc__mutex_initialize();
isc__mem_initialize();
isc__random_initialize();
isc__tls_initialize();
isc__uv_initialize();
isc__xml_initialize();