summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* tsan: support longjmp out of signal handlersDmitry Vyukov2014-09-161-0/+12
| | | | | | Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=75 llvm-svn: 217908
* tsan: use growable vector for atexit callbacksDmitry Vyukov2014-09-121-10/+6
| | | | | | Most real programs setup much more than 1024 callbacks. llvm-svn: 217713
* tsan: handle early signalsDmitry Vyukov2014-09-031-1/+1
| | | | | | | The second part of the fix of https://code.google.com/p/thread-sanitizer/issues/detail?id=71 llvm-svn: 217031
* tsan: more precise handling of atexit callbacksDmitry Vyukov2014-09-021-30/+57
| | | | | | Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=74 llvm-svn: 216906
* tsan: disable getpwent interceptorsDmitry Vyukov2014-09-021-0/+12
| | | | | | | | | | | There interceptors do not seem to be strictly necessary for tsan. But we see cases where the interceptors consume 70% of execution time. Memory blocks passed to fgetgrent_r are "written to" by tsan several times. First, there is some recursion (getgrnam_r calls fgetgrent_r), and each function "writes to" the buffer. Then, the same memory is "written to" twice, first as buf and then as pwbufp (both of them refer to the same addresses). llvm-svn: 216904
* tsan: restructure signal handling to allow recursive handlingDmitry Vyukov2014-09-021-22/+28
| | | | | | | Fixes issue https://code.google.com/p/thread-sanitizer/issues/detail?id=71 llvm-svn: 216903
* tsan: fix false positive related to signal handlersDmitry Vyukov2014-09-011-0/+2
| | | | | | | Users expect synchronization between sigaction and arrival of the signal. See the test for details. llvm-svn: 216878
* [sanitizer] move mlock interceptor from asan/tsan/msan to common; no ↵Kostya Serebryany2014-08-251-34/+0
| | | | | | functionality change intended llvm-svn: 216407
* [Sanitizer] Make SuppressionContext a singleton class, residing in ↵Alexey Samsonov2014-07-301-1/+1
| | | | | | | | | | sanitizer_common. Convert TSan and LSan to the new interface. More changes will follow: 1) "suppressions" should become a common runtime flag. 2) Code for parsing suppressions file should be moved to SuppressionContext::Init(). llvm-svn: 214334
* [tsan] fix pthread_rwlock_tryrdlock interceptor, don't try to detect ↵Kostya Serebryany2014-07-081-1/+1
| | | | | | deadlocks when reporting bad unlock llvm-svn: 212526
* [sanitizer] support c11 aligned_alloc, Linux only for nowKostya Serebryany2014-07-041-0/+5
| | | | llvm-svn: 212322
* [TSan] Equalize the behavior of __tsan_get_allocated_size and ↵Alexey Samsonov2014-07-011-1/+1
| | | | | | | | | | | user_alloc_usable_size. The former used to crash with a null deref if it was given a not owned pointer, while the latter returned 0. Now they both return 0. This is still not the best possible behavior: it is better to print an error report with a stack trace, pointing to the error in user code, as we do in ASan. llvm-svn: 212112
* [sanitizer] Intercept pthread_*attr_get*.Evgeniy Stepanov2014-06-191-2/+2
| | | | | | This is a resubmit of r211166 reverted due to osx breakage. llvm-svn: 211264
* Revert "[sanitizer] Intercept pthread_*attr_get*."Arnold Schwaighofer2014-06-181-2/+2
| | | | | | This reverts commit r211166. It broke public mac os x bots. llvm-svn: 211206
* [sanitizer] Intercept pthread_*attr_get*.Evgeniy Stepanov2014-06-181-2/+2
| | | | llvm-svn: 211166
* tsan: refactor storage of meta information for heap blocks and sync objectsDmitry Vyukov2014-05-291-1/+2
| | | | | | | | | | | | | | | The new storage (MetaMap) is based on direct shadow (instead of a hashmap + per-block lists). This solves a number of problems: - eliminates quadratic behaviour in SyncTab::GetAndLock (https://code.google.com/p/thread-sanitizer/issues/detail?id=26) - eliminates contention in SyncTab - eliminates contention in internal allocator during allocation of sync objects - removes a bunch of ad-hoc code in java interface - reduces java shadow from 2x to 1/2x - allows to memorize heap block meta info for Java and Go - allows to cleanup sync object meta info for Go - which in turn enabled deadlock detector for Go llvm-svn: 209810
* tsan: refactor suppressions machineryDmitry Vyukov2014-05-281-2/+2
| | | | | | | | | | The refactoring makes suppressions more flexible and allow to suppress based on arbitrary number of stacks. In particular it fixes: https://code.google.com/p/thread-sanitizer/issues/detail?id=64 "Make it possible to suppress deadlock reports by any stack (not just first)" llvm-svn: 209757
* [asancov] Write coverage directly to a memory-mapped file.Evgeniy Stepanov2014-05-271-17/+13
| | | | | | | | | | | This way does not require a __sanitizer_cov_dump() call. That's important on Android, where apps can be killed at arbitrary time. We write raw PCs to disk instead of module offsets; we also write memory layout to a separate file. This increases dump size by the factor of 2 on 64-bit systems. llvm-svn: 209653
* [msan] Better open_memstream support.Evgeniy Stepanov2014-05-131-24/+2
| | | | | | | | Move fflush and fclose interceptors to sanitizer_common. Use a metadata map to keep information about the external locations that must be updated when the file is written to. llvm-svn: 208676
* [sanitizer] Replace a macro with a function.Evgeniy Stepanov2014-05-071-1/+1
| | | | llvm-svn: 208207
* tsan: disable debug output in normal modeDmitry Vyukov2014-05-051-6/+5
| | | | llvm-svn: 207954
* [sanitizer] Intercept a bunch of stdio calls.Evgeniy Stepanov2014-04-251-62/+13
| | | | | | Add move fopen/freopen interceptors from TSan to common. llvm-svn: 207224
* tsan: stop background thread when sandbox is enabledDmitry Vyukov2014-04-241-2/+6
| | | | | | Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=56 llvm-svn: 207114
* tsan: fix atexit handling after forkDmitry Vyukov2014-04-231-1/+3
| | | | | | fixes issue http://code.google.com/p/thread-sanitizer/issues/detail?id=57 llvm-svn: 206980
* Move pthread_cond_* interceptors from sanitizer_common with all the ugly ↵Alexey Samsonov2014-04-161-0/+124
| | | | | | hacks to TSan llvm-svn: 206423
* [tsan] Remove an accidentally committed debug print.Alexander Potapenko2014-04-011-1/+0
| | | | llvm-svn: 205316
* [TSan] Replace several Printf() calls with Report() to ease debugging.Alexander Potapenko2014-03-311-7/+8
| | | | llvm-svn: 205175
* tsan: deobfuscate global ctx variableDmitry Vyukov2014-03-201-3/+2
| | | | llvm-svn: 204327
* tsan: add interceptors for fopen64, freopen64, tmpfile, tmpfile64Dmitry Vyukov2014-03-121-0/+55
| | | | llvm-svn: 203647
* [sanitizer] Simplify interceptors with user callbacks.Evgeniy Stepanov2014-03-061-3/+0
| | | | | | | Get rid of the context argument in UNPOISON_PARAM and INITIALIZE_RANGE. Get rid of all the thread-local contexts in interceptors. llvm-svn: 203119
* Add common interceptors for memchr/memrchrAlexey Samsonov2014-03-051-16/+0
| | | | llvm-svn: 202972
* tsan: move all pthread_cond interceptors into sanitizer_commonDmitry Vyukov2014-03-041-20/+0
| | | | llvm-svn: 202813
* tsan: intercept vforkDmitry Vyukov2014-02-271-0/+18
| | | | | | | this fixes obscure false positives see the comments and the test for details llvm-svn: 202400
* [sanitizer] partially support pthread_rwlock_* (no rd* form yet)Kostya Serebryany2014-02-251-2/+2
| | | | llvm-svn: 202128
* [sanitizer] add support for try_lock in deadlock detectorKostya Serebryany2014-02-251-2/+2
| | | | llvm-svn: 202120
* tsan: fix SIGRTMAX handlingDmitry Vyukov2014-02-241-1/+5
| | | | llvm-svn: 202022
* AdjustStackSizeLinux() is used in Lsan, Tsan and Msan non-Linux-specific ↵Kostya Serebryany2014-02-241-1/+1
| | | | | | | | | code so it seems it should have more generic name and moved to a common scope. Renamed to AdjustStackSize. Patch by Viktor Kutuzov. llvm-svn: 202011
* [TSan] Fix mismatched mangled names in operator delete interceptorsAlexey Samsonov2014-02-101-2/+2
| | | | llvm-svn: 201069
* Stick to C++98 for this.Nick Lewycky2014-02-081-4/+4
| | | | llvm-svn: 201015
* Update these declarations of operator delete (and delete[]) to have noexcept,Nick Lewycky2014-02-081-4/+4
| | | | | | | as required per core issue 1552 and warned about with -Wimplicit-exception-spec-mismatch. llvm-svn: 201014
* [TSan] Don't flush all file streams on program shutdown to avoid deadlocks ↵Alexander Potapenko2014-02-061-1/+6
| | | | | | | | on file stream locks. This should fix https://code.google.com/p/thread-sanitizer/issues/detail?id=47. llvm-svn: 200922
* tsan: relax check for errno spoiling moreDmitry Vyukov2014-02-041-1/+9
| | | | | | | | | | | | We do not detect errno spoiling for SIGTERM, because some SIGTERM handlers do spoil errno but reraise SIGTERM, tsan reports false positive in such case. It's difficult to properly detect this situation (reraise), because in async signal processing case (when handler is called directly from rtl_generic_sighandler) we have not yet received the reraised signal; and it looks too fragile to intercept all ways to reraise a signal. llvm-svn: 200742
* Make signal-related functions use __sanitizer_* structures instead of ↵Alexander Potapenko2014-01-311-1/+1
| | | | | | | | | | | __sanitizer_kernel_* ones. Also rename internal_sigaction() into internal_sigaction_norestorer(), as this function doesn't fully implement the sigaction() functionality on Linux. This change is a part of refactoring intended to have common signal handling behavior in all tools. llvm-svn: 200535
* tsan: remove interceptor statsDmitry Vyukov2014-01-281-2/+0
| | | | | | They seems to be unused, but cause maintenance pain. llvm-svn: 200308
* tsan: relax checking of errno spoiling in signal handlersDmitry Vyukov2014-01-281-18/+24
| | | | | | | allow SIGABRT to spoil errno, because some real programs reset SIGABRT handler in the handler, re-raise SIGABRT and return from the handler llvm-svn: 200304
* tsan: fix signal handlingDmitry Vyukov2014-01-241-51/+67
| | | | | | | We left ignore_interceptors>0 when calling signal handlers from blocking interceptors, this leads to missing synchronization in such signal handler. llvm-svn: 200003
* tsan: do not deadlock on forkDmitry Vyukov2014-01-241-3/+30
| | | | | | | | | | | | | 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
* tsan: fix false positive in pthread stack manupulationDmitry Vyukov2013-12-241-0/+4
| | | | | | pthread uses internal cache, we do not see synchronization in it llvm-svn: 197982
* tsan: remove in_rtl counterDmitry Vyukov2013-12-241-60/+23
| | | | | | | | 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: add support for passing file descriptors over UNIX domain socketsDmitry Vyukov2013-11-281-0/+12
| | | | | | | tsan was missing new fd's arrived from recvmsg(), and thus was reporting false positives due to missed synchronization on the fd's llvm-svn: 195914
OpenPOWER on IntegriCloud