hanchenye-llvm-project/compiler-rt/lib/lsan
Maxim Ostapenko 984f42eed5 [asan/lsan] Avoid possible deadlock in dynamic ASan runtime thread initialization.
There is possible deadlock in dynamic ASan runtime when we dlopen() shared lib
which creates a thread at the global initialization stage. The scenario:

1) dlopen grabs a GI_pthread_mutex_lock in main thread.
2) main thread calls pthread_create, ASan intercepts it, calls real pthread_create
   and waits for the second thread to be "fully initialized".
3) Newly created thread tries to access a thread local disable_counter in LSan
   (to complete its "full initialization") and hangs in tls_get_addr_tail, because
   it also tries to acquire GI_pthread_mutex_lock.

The issue is reproducible on relative recent Glibc versions e.g. 2.23.

Differential Revision: https://reviews.llvm.org/D26028

llvm-svn: 285385
2016-10-28 06:49:53 +00:00
..
.clang-format Tell clang-format that (most) sanitizers are written using Google style guide. 2015-11-19 22:11:10 +00:00
CMakeLists.txt [CMake] Connect Compiler-RT targets to LLVM Runtimes directory 2016-08-26 20:52:22 +00:00
lsan.cc [sanitizer] [SystemZ] Abort if the kernel might be vulnerable to CVE-2016-2143. 2016-04-27 17:42:00 +00:00
lsan.h [LSAN] Fix test swapcontext.cc on MIPS 2016-05-18 06:09:26 +00:00
lsan_allocator.cc [sanitizer] enable random shuffling the memory chunks inside the allocator, under a flag. Set this flag for the scudo allocator, add a test. 2016-08-26 00:06:03 +00:00
lsan_allocator.h
lsan_common.cc [asan/lsan] Avoid possible deadlock in dynamic ASan runtime thread initialization. 2016-10-28 06:49:53 +00:00
lsan_common.h [LSan] Ignore all allocations made inside pthread_create. 2016-01-16 00:57:25 +00:00
lsan_common_linux.cc [lsan] Relax check for allocator_end in ProcessGlobalRegionsCallback. 2016-10-26 06:56:51 +00:00
lsan_flags.inc [LSan] Add "use_ld_allocations" flag to disable old way of DTLS handling. 2016-01-14 19:16:05 +00:00
lsan_interceptors.cc [LSan] Ignore all allocations made inside pthread_create. 2016-01-16 00:57:25 +00:00
lsan_preinit.cc
lsan_thread.cc [compiler-rt][lsan] Fix compiler error due to attribute (windows) 2016-09-23 15:11:41 +00:00
lsan_thread.h [LSan] Use __tls_get_addr interceptor to keep track of dynamic TLS. 2016-01-14 18:50:09 +00:00