The current initialization code is not thread-safe, and assumes that the
only possible caller of open() before initialization completes is
dlsym(), which is not the case if there are other preloaded libraries.
This patch makes the initialization thread-safe by using thread-local
variables, and adjusts the recursive checking logic to support early
callers.
The current initialization code is not thread-safe, and assumes that the only possible caller of open() before initialization completes is dlsym(), which is not the case if there are other preloaded libraries.
This patch makes the initialization thread-safe by using thread-local variables, and adjusts the recursive checking logic to support early callers.
See Debian bug #918520 for more background: https://bugs.debian.org/918520
Signed-off-by: Mattia Rizzolo mattia@debian.org