llvm-project/compiler-rt/test
Kostya Kortchinsky 040c211bc4 [scudo] Fix improper TSD init after TLS destructors are called
Summary:
Some of glibc's own thread local data is destroyed after a user's thread local
destructors are called, via __libc_thread_freeres. This might involve calling
free, as is the case for strerror_thread_freeres.
If there is no prior heap operation in the thread, this free would end up
initializing some thread specific data that would never be destroyed properly
(as user's pthread destructors have already been called), while still being
deallocated when the TLS goes away. As a result, a program could SEGV, usually
in __sanitizer::AllocatorGlobalStats::Unregister, where one of the doubly linked
list links would refer to a now unmapped memory area.

To prevent this from happening, we will not do a full initialization from the
deallocation path. This means that the fallback cache & quarantine will be used
if no other heap operation has been called, and we effectively prevent the TSD
being initialized and never destroyed. The TSD will be fully initialized for all
other paths.

In the event of a thread doing only frees and nothing else, a TSD would never
be initialized for that thread, but this situation is unlikely and we can live
with that.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 312939
2017-09-11 19:59:40 +00:00
..
BlocksRuntime
asan [asan] Include asan-dynamic into check-all 2017-09-11 19:41:17 +00:00
builtins These tests use 80-bit long doubles, which are x86 only. Mark them so. 2017-08-03 18:56:54 +00:00
cfi [cfi] only add cfi tests on supported arches. 2017-08-25 01:50:53 +00:00
dfsan [mips] XFAIL dfsan's custom.cc test on mips64. 2017-05-09 19:17:16 +00:00
esan [tsan] Update unittest for logging changes of r308637 2017-07-20 20:06:00 +00:00
fuzzer [libFuzzer] simplify CustomCrossOverTest even more 2017-09-07 05:33:05 +00:00
interception Revert "[interception] Check for export table's size before referring to its elements." 2017-01-22 03:30:14 +00:00
lsan Revert "Prevent DCE on __lsan_is_turned_off and re-enable test case" 2017-09-08 21:09:43 +00:00
msan [msan] Check sigset_t and sigaction arguments. 2017-09-05 21:08:56 +00:00
profile Revert: Enable profile on NetBSD 2017-08-15 09:56:47 +00:00
safestack Enable SafeStack on NetBSD 2017-08-10 18:40:09 +00:00
sanitizer_common [ubsan] Enable UBsan in sanitizer_common tests 2017-09-09 06:10:58 +00:00
scudo [scudo] Fix improper TSD init after TLS destructors are called 2017-09-11 19:59:40 +00:00
tsan Add NetBSD support in test/tsan/thread_name*.cc 2017-08-30 19:40:47 +00:00
ubsan Enable ubsan on NetBSD 2017-08-08 20:49:20 +00:00
ubsan_minimal [ubsan] Give ubsan-minimal lit test suite a name. 2017-08-31 00:54:10 +00:00
xray [compiler-rt][xray][mips] Mark some tests as unsupported. 2017-09-06 10:17:29 +00:00
CMakeLists.txt Revert "[ubsan] Make check-ubsan depend on check-ubsan-minimal." 2017-08-31 23:34:01 +00:00
lit.common.cfg Reland r311842 - [cmake] Remove i686 target that is duplicate to i386 2017-08-28 20:30:12 +00:00
lit.common.configured.in [asan] Add support for running lit tests in the iOS Simulator 2017-04-26 18:59:22 +00:00