summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_rtl.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* tsan: allow to disable history collectionDmitry Vyukov2014-05-151-14/+24
| | | | | | | The mode is enabled with -DTSAN_NO_HISTORY=1 flag. Intended mostly for research purposes (how fast can it go w/o history). llvm-svn: 208878
* tsan: stop background thread when sandbox is enabledDmitry Vyukov2014-04-241-4/+22
| | | | | | Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=56 llvm-svn: 207114
* tsan: fix vector clocksDmitry Vyukov2014-04-111-2/+3
| | | | | | | the new optimizations break when thread ids gets reused (clocks go backwards) add the necessary tests as well llvm-svn: 206035
* [TSan] Fix a rare deadlock on multithreaded fork.Alexey Samsonov2014-04-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | If a multi-threaded program calls fork(), TSan ignores all memory accesses in the child to prevent deadlocks in TSan runtime. This is OK, as child is probably going to call exec() as soon as possible. However, a rare deadlocks could be caused by ThreadIgnoreBegin() function itself. ThreadIgnoreBegin() remembers the current stack trace and puts it into the StackDepot to report a warning later if a thread exited with ignores enabled. Using StackDepotPut in a child process is dangerous: it locks a mutex on a slow path, which could be already locked in a parent process. The fix is simple: just don't put current stack traces to StackDepot in ThreadIgnoreBegin() and ThreadIgnoreSyncBegin() functions if we're running after a multithreaded fork. We will not report any "thread exited with ignores enabled" errors in this case anyway. Submitting this without a testcase, as I believe the standalone reproducer is pretty hard to construct. llvm-svn: 205534
* [TSan] Fix a typo ThreadIgnoreSyncEnd. Found by inspectionAlexey Samsonov2014-04-031-1/+1
| | | | llvm-svn: 205531
* tsan: fix deadlock during forkDmitry Vyukov2014-03-261-3/+3
| | | | | | ReportRace takes the two mutexes in the opposite order llvm-svn: 204809
* tsan: optimize vector clock operationsDmitry Vyukov2014-03-241-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make vector clock operations O(1) for several important classes of use cases. See comments for details. Below are stats from a large server app, 77% of all clock operations are handled as O(1). Clock acquire : 25983645 empty clock : 6288080 fast from release-store : 14917504 contains my tid : 4515743 repeated (fast) : 2141428 full (slow) : 2636633 acquired something : 1426863 Clock release : 2544216 resize : 6241 fast1 : 197693 fast2 : 1016293 fast3 : 2007 full (slow) : 1797488 was acquired : 709227 clear tail : 1 last overflow : 0 Clock release store : 3446946 resize : 200516 fast : 469265 slow : 2977681 clear tail : 0 Clock acquire-release : 820028 llvm-svn: 204656
* tsan: deobfuscate global ctx variableDmitry Vyukov2014-03-201-9/+1
| | | | llvm-svn: 204327
* tsan: preliminary support for Go deadlock detectorDmitry Vyukov2014-03-191-2/+0
| | | | llvm-svn: 204228
* tsan: deadlock detector: add deadlock detector flagsDmitry Vyukov2014-03-181-1/+1
| | | | | | the first flags is to enable printing of the second stack per edge llvm-svn: 204150
* tsan: refactor deadlock detectorDmitry Vyukov2014-02-281-3/+3
| | | | | | | | Introduce DDetector interface between the tool and the DD itself. It will help to experiment with other DD implementation, as well as reuse DD in other tools. llvm-svn: 202485
* tsan: fix internal deadlock detector for external deadlock detectorDmitry Vyukov2014-02-271-1/+1
| | | | | | we must go deeper! llvm-svn: 202365
* [tsan] add coarse-grained lock around the DeadlockDetector. We can do better ↵Kostya Serebryany2014-02-211-1/+3
| | | | | | than that, but that's a start. llvm-svn: 201861
* [sanitizer] Use mmap to zero-fill large shadow regions.Evgeniy Stepanov2014-02-141-1/+1
| | | | | | | | | | This is covered by existing ASan test. This does not change anything for TSan by default (but provides a flag to change the threshold size). Based on a patch by florent.bruneau here:   https://code.google.com/p/address-sanitizer/issues/detail?id=256 llvm-svn: 201400
* tsan: run user OnInitialize callback laterDmitry Vyukov2014-02-071-1/+2
| | | | | | | when global and thread state are initialized, this allows to do more things in the callback. llvm-svn: 200966
* tsan: fix windows alignment checkDmitry Vyukov2014-02-051-1/+3
| | | | llvm-svn: 200838
* tsan: ensure proper alignment of mmaps on windowsDmitry Vyukov2014-02-051-0/+2
| | | | llvm-svn: 200832
* tsan: add SANITIZER_INTERFACE_ATTRIBUTE to more callbacksDmitry Vyukov2014-02-041-0/+2
| | | | | | so that it's possible to override them from a dynamic library. llvm-svn: 200747
* tsan: do not deadlock on forkDmitry Vyukov2014-01-241-0/+36
| | | | | | | | | | | | | Currently correct programs can deadlock after fork, because atomic operations and async-signal-safe calls are not async-signal-safe under tsan. With this change: - if a single-threaded program forks, the child continues running with verification enabled (the tsan background thread is recreated as well) - if a multi-threaded program forks, then the child runs with verification disabled (memory accesses, atomic operations and interceptors are disabled); it's expected that it will exec soon anyway - if the child tries to create more threads after multi-threaded fork, the program aborts with error message - die_after_fork flag is added that allows to continue running, but all bets are off http://llvm-reviews.chandlerc.com/D2614 llvm-svn: 199993
* [Sanitizer] Replace Symbolizer::IsAvailable and ↵Alexey Samsonov2013-12-251-10/+1
| | | | | | | | Symbolizer::IsExternalAvailable with Symbolizer::CanReturnFileLineInfo. Remove now redundant checks in symbolizer initialization in TSan and MSan. llvm-svn: 198000
* tsan: remove in_rtl counterDmitry Vyukov2013-12-241-8/+5
| | | | | | | | This is intended to address the following problem. Episodically we see CHECK-failures when recursive interceptors call back into user code. Effectively we are not "in_rtl" at this point, but it's very complicated and fragile to properly maintain in_rtl property. Instead get rid of it. It was used mostly for sanity CHECKs, which basically never uncover real problems. Instead introduce ignore_interceptors flag, which is used in very few narrow places to disable recursive interceptors (e.g. during runtime initialization). llvm-svn: 197979
* [TSan] Replace __tsan::OverrideFlags with __tsan::OnInitializeAlexey Samsonov2013-12-111-0/+3
| | | | llvm-svn: 197014
* tsan: better diagnostics if thread finishes with ignores enabledDmitry Vyukov2013-11-271-5/+19
| | | | | | | print thread creation stack and stacks where ignores were enabled. llvm-svn: 195836
* [Sanitizer] Add Symbolizer::AddHooks() and use it in TSan and MSan.Alexey Samsonov2013-10-311-0/+1
| | | | | | | | | | | | | | | | | | | | | Summary: TSan and MSan need to know if interceptor was called by the user code or by the symbolizer and use pre- and post-symbolization hooks for that. Make Symbolizer class responsible for calling these hooks instead. This would ensure the hooks are only called when necessary (during in-process symbolization, they are not needed for out-of-process) and save specific sanitizers from tracing all places in the code where symbolization will be performed. Reviewers: eugenis, dvyukov Reviewed By: eugenis CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2067 llvm-svn: 193807
* Overhaul the symbolizer interface.Peter Collingbourne2013-10-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | This moves away from creating the symbolizer object and initializing the external symbolizer as separate steps. Those steps now always take place together. Sanitizers with a legacy requirement to specify their own symbolizer path should use InitSymbolizer to initialize the symbolizer with the desired path, and GetSymbolizer to access the symbolizer. Sanitizers with no such requirement (e.g. UBSan) can use GetOrInitSymbolizer with no need for initialization. The symbolizer interface has been made thread-safe (as far as I can tell) by protecting its member functions with mutexes. Finally, the symbolizer interface no longer relies on weak externals, the introduction of which was probably a mistake on my part. Differential Revision: http://llvm-reviews.chandlerc.com/D1985 llvm-svn: 193448
* tsan: move shadow stack from thread descriptors to fixed addressesDmitry Vyukov2013-10-161-7/+8
| | | | | | | | This allows to increase max shadow stack size to 64K, and reliably catch shadow stack overflows instead of silently corrupting memory. llvm-svn: 192797
* tsan: use sanitizer::CommonFlags in tsanDmitry Vyukov2013-10-151-6/+1
| | | | llvm-svn: 192692
* tsan: allow to override OnFinalize() in front-ends that does not support ↵Dmitry Vyukov2013-10-141-1/+5
| | | | | | weak functions (Go) llvm-svn: 192569
* tsan: add annotations to ignore synchronization operationsDmitry Vyukov2013-10-101-1/+13
| | | | | | | | The annotations are AnnotateIgnoreSyncBegin/End, may be useful to ignore some infrastructure synchronization that introduces lots of false negatives. llvm-svn: 192355
* [TSan] Automatically pick up llvm-symbolizer from PATH, as we do in another ↵Alexey Samsonov2013-10-041-6/+7
| | | | | | sanitizers llvm-svn: 191954
* tsan: add memory_limit_mb flagDmitry Vyukov2013-10-031-1/+22
| | | | | | | The flag allows to bound maximum process memory consumption (best effort). If RSS reaches memory_limit_mb, tsan flushes all shadow memory. llvm-svn: 191913
* tsan: ignore interceptors coming from specified librariesDmitry Vyukov2013-10-031-0/+1
| | | | | | | | | | | | | LibIgnore allows to ignore all interceptors called from a particular set of dynamic libraries. LibIgnore remembers all "called_from_lib" suppressions from the provided SuppressionContext; finds code ranges for the libraries; and checks whether the provided PC value belongs to the code ranges. Also make malloc and friends interceptors use SCOPED_INTERCEPTOR_RAW instead of SCOPED_TSAN_INTERCEPTOR, because if they are called from an ignored lib, then must call our internal allocator instead of libc malloc. llvm-svn: 191897
* tsan: refactor internal IgnoreCtl interfaceDmitry Vyukov2013-09-191-6/+11
| | | | llvm-svn: 190987
* [Sanitizer] Refactor symbolization interface: use class instead of several ↵Alexey Samsonov2013-09-101-1/+1
| | | | | | functions. Move some code around to get rid of extra source files llvm-svn: 190410
* [TSan] use InternalMmapVector to store fired suppressionsAlexey Samsonov2013-06-141-1/+1
| | | | llvm-svn: 183974
* tsan: fix Windows Go crashDmitry Vyukov2013-06-131-1/+3
| | | | llvm-svn: 183898
* tsan: detect when a thread ends with ignores enabledDmitry Vyukov2013-05-211-2/+1
| | | | llvm-svn: 182354
* [nolibc] Move all platforms to internal_getpid.Peter Collingbourne2013-05-171-4/+4
| | | | | | | | | | Before, we had an unused internal_getpid function for Linux, and a platform-independent GetPid function. To make the naming conventions consistent for syscall-like functions, the GetPid syscall wrapper in sanitizer_posix.cc is moved to sanitizer_mac.cc, and GetPid is renamed to internal_getpid, bringing the Linux variant into use. llvm-svn: 182132
* [nolibc] Change internal syscall API to remove reliance on libc's errno.Peter Collingbourne2013-05-081-2/+4
| | | | | | | | | | | | | This change moves to a model where the error value of a system call is potentially contained in the return value itself rather than being implicit in errno. The helper function internal_iserror can be used to extract the error value from a return value. On platforms other than Linux/x86_64 this still uses errno, but other platforms are free to port their error handling to this new model. Differential Revision: http://llvm-reviews.chandlerc.com/D756 llvm-svn: 181436
* tsan: add interface functions for unaligned access, e.g. ↵Dmitry Vyukov2013-04-301-0/+21
| | | | | | __sanitizer_unaligned_load16 llvm-svn: 180780
* tsan: fix stack traces for malloc and freeDmitry Vyukov2013-04-241-0/+4
| | | | llvm-svn: 180184
* [Sanitizer] Use a common mutex to prevent mixing reports from different ↵Alexey Samsonov2013-04-051-0/+3
| | | | | | sanitizers. This fixes PR15516 llvm-svn: 178853
* [tsan] restore performance critical inlining in tsan: remove static from ↵Kostya Serebryany2013-03-291-4/+4
| | | | | | ALWAYS_INLINE, use ALWAYS_INLINE USED for critical functions. llvm-svn: 178341
* Band-aid fix for the TSan RTL buildTimur Iskhodzhanov2013-03-281-7/+7
| | | | llvm-svn: 178298
* tsan: print statistics about benign race annotationsDmitry Vyukov2013-03-281-0/+4
| | | | | | | (total count, unique, matched) if requested with print_benign=1 flag. llvm-svn: 178245
* tsan: print matched suppressions if print_suppressions=1 flag is providedDmitry Vyukov2013-03-271-0/+3
| | | | llvm-svn: 178159
* tsan: intercept setjmp/longjmpDmitry Vyukov2013-03-251-0/+3
| | | | llvm-svn: 177858
* tsan: add flag to control symbolizer flush frequencyDmitry Vyukov2013-03-211-7/+11
| | | | llvm-svn: 177638
* tsan: flush symbolizer cache if not symbolized for more than 5 secondsDmitry Vyukov2013-03-211-4/+17
| | | | llvm-svn: 177629
* tsan: use a single background thread for memory profiler and memory flush ↵Dmitry Vyukov2013-03-211-43/+39
| | | | | | (and later for symbolizer flush) llvm-svn: 177627
OpenPOWER on IntegriCloud