summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_thread_registry.h
AgeCommit message (Collapse)Author
2017-11-26Prevent Thread Exited/Joined events raceKamil Rytarowski
Summary: Add atomic verification to ensure that Thread is Joined after marking it Finished. It is required for NetBSD in order to prevent Thread Exited/Joined race, that may occur when native system libpthread(3) cannot be reliably traced in a way to guarantee that the mentioned events happen one after another. This change fixes at least TSan and LSan on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dvyukov, vitalybuka Reviewed By: dvyukov Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40294 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319004 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-17[sanitizer] Introduce tid_t as a typedef for OS-provided thread IDsKuba Mracek
We seem to assume that OS-provided thread IDs are either uptr or int, neither of which is true on Darwin. This introduces a tid_t type, which holds a OS-provided thread ID (gettid on Linux, pthread_threadid_np on Darwin, pthread_self on FreeBSD). Differential Revision: https://reviews.llvm.org/D31774 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300473 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02[tsan] Properly describe GCD worker threads in reportsKuba Mracek
When dealing with GCD worker threads, TSan currently prints weird things like "created by thread T-1" and "[failed to restore the stack]" in reports. This patch avoids that and instead prints "Thread T3 (...) is a GCD worker thread". Differential Revision: https://reviews.llvm.org/D29103 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293882 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29[sanitizer] Fix Clang-tidy modernize-use-nullptr warnings in ↵Kostya Serebryany
lib/sanitizer_common headers, unify closing inclusion guards. Patch by Eugene Zelenko git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@248816 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02tsan: address comments in r214912Dmitry Vyukov
See http://reviews.llvm.org/D4794 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216900 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-05tsan: allocate vector clocks using slab allocatorDmitry Vyukov
Vector clocks is the most actively allocated object in tsan runtime. Current internal allocator is not scalable enough to handle allocation of clocks in scalable way (too small caches). This changes transforms clocks to 2-level array with 512-byte blocks. Since all blocks are of the same size, it's possible to cache them more efficiently in per-thread caches. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214912 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-11tsan: fix vector clocksDmitry Vyukov
the new optimizations break when thread ids gets reused (clocks go backwards) add the necessary tests as well git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206035 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29tsan/asan: support pthread_setname_np to set thread namesDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193602 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-27[sanitizer] Move FindThreadByOSIdLocked from lsan to sanitizer_common.Sergey Matveev
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182728 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25[Sanitizer] Compile sanitizer runtimes with -Wno-non-virtual-dtor. Virtual ↵Alexey Samsonov
dtors may be a problem for us, as sanitizer runtime should not generally assume libstdc++ presence. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177860 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19tsan: flush dead thread info earlier (when another thread is finished rather ↵Dmitry Vyukov
than new thread is created) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177394 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18tsan: fix clang -Wall buildDmitry Vyukov
Clang does not like classes with virtual functions but w/o virtual dtor. Go does not like libstdc++ (operator delete). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177267 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18tsan: fix Go buildDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177260 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15[Sanitizer] Build sanitizer_common tests w/o RTTI. Move ThreadRegistry class ↵Alexey Samsonov
members below methods. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177143 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-15Fix a virtual destructor warning.Eric Christopher
Patch by Manuel Klimek! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177132 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14[Sanitizer] Fix compiler warnings and style issues in sanitizer_common ↵Alexey Samsonov
tests. Use -Werror=sign-compare when building them. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177077 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14[Sanitizer] Add generic ThreadRegistry class for sanitizer runtimes. This ↵Alexey Samsonov
class holds basic thread bookkeeping logic and allows specific sanitizer runtimes to create thread contexts and mark threads as created/running/joined etc. The class is based on the way we currently store thread contexts in TSan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@177074 91177308-0d34-0410-b5e6-96231b3b80d8