llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) <details> <summary>Changes</summary> We do that for other Sanitizers, and we should do the same for TSAN. There are know deadlocks reports here. --- Full diff: https://github.com/llvm/llvm-project/pull/96600.diff 2 Files Affected: - (modified) compiler-rt/lib/tsan/rtl/tsan_mman.cpp (+10) - (modified) compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c (-3) ``````````diff diff --git a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp index 1e579c6a020e9..e129e9af272f5 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp @@ -17,6 +17,7 @@ #include "sanitizer_common/sanitizer_common.h" #include "sanitizer_common/sanitizer_errno.h" #include "sanitizer_common/sanitizer_placement_new.h" +#include "sanitizer_common/sanitizer_stackdepot.h" #include "tsan_flags.h" #include "tsan_interface.h" #include "tsan_report.h" @@ -119,9 +120,18 @@ ScopedGlobalProcessor::~ScopedGlobalProcessor() { void AllocatorLockBeforeFork() SANITIZER_NO_THREAD_SAFETY_ANALYSIS { global_proc()->internal_alloc_mtx.Lock(); InternalAllocatorLock(); +#if !SANITIZER_APPLE + // OS X allocates from hooks, see 6a3958247a. + allocator()->ForceLock(); + StackDepotLockBeforeFork(); +#endif } void AllocatorUnlockAfterFork(bool child) SANITIZER_NO_THREAD_SAFETY_ANALYSIS { +#if !SANITIZER_APPLE + StackDepotUnlockAfterFork(child); + allocator()->ForceUnlock(); +#endif InternalAllocatorUnlock(); global_proc()->internal_alloc_mtx.Unlock(); } diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c index 13240234a1c79..27b67db0c0a38 100644 --- a/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c +++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/fork_threaded.c @@ -6,9 +6,6 @@ // FIXME: It probably hangs on this platform. // UNSUPPORTED: ppc -// FIXME: TSAN does not lock allocator. -// UNSUPPORTED: tsan - // FIXME: False stack overflow report // UNSUPPORTED: android && asan `````````` </details> https://github.com/llvm/llvm-project/pull/96600 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits