summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl
Commit message (Collapse)AuthorAgeFilesLines
...
* Improve error message when '=' is missing in {ASAN,...}_OPTIONS.Vitaly Buka2019-06-153-6/+8
| | | | | | | | | | | | | | | | | | Summary: It's handling isses as described here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89832 Patch by Martin Liška. Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: cryptoad, kubamracek Differential Revision: https://reviews.llvm.org/D59876 llvm-svn: 363480
* [Sanitizer] Reland "Cleanup INTERCEPT_FUNCTION macro"Julian Lettner2019-05-011-7/+6
| | | | | | | | | | | | | | | | | | | | | | On Linux both version of the INTERCEPT_FUNCTION macro now return true when interception was successful. Adapt and cleanup some usages. Also note that `&(func) == &WRAP(func)` is a link-time property, but we do a runtime check. Tested on Linux and macOS. Previous attempt reverted by: 5642c3feb03d020dc06a62e3dc54f3206a97a391 This attempt to bring order to the interceptor macro goes the other direction and aligns the Linux implementation with the way things are done on Windows. Reviewed By: vitalybuka, rnk Differential Revision: https://reviews.llvm.org/D61358 llvm-svn: 359725
* [sanitizer][NFC] Set LargeMmapAllocator type from PrimaryAllocatorVitaly Buka2019-05-011-2/+1
| | | | | | | | | | | | | | They need to have same AddressSpaceView and MapUnmapCallback. Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61168 llvm-svn: 359719
* [sanitizer][NFC] Get type of AllocatorCache from CombinedAllocatorVitaly Buka2019-05-011-3/+2
| | | | | | | | | | | | | | Reviewers: eugenis, cryptoad, kcc Reviewed By: kcc Subscribers: kcc, kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61155 llvm-svn: 359715
* [sanitizer] Implement reallocarray.Evgeniy Stepanov2019-05-013-0/+25
| | | | | | | | | | | | | | | | Summary: It's a cross of calloc and realloc. Sanitizers implement calloc-like check for size overflow. Reviewers: vitalybuka, kcc Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61108 llvm-svn: 359708
* Revert r359325 "[NFC][Sanitizer] Change "return type" of INTERCEPT_FUNCTION ↵Reid Kleckner2019-04-301-7/+17
| | | | | | | | | | | | | | | to void" Changing INTERCEPT_FUNCTION to return void is not functionally correct. IMO the best way to communicate failure or success of interception is with a return value, not some external address comparison. This change was also creating link errors for _except_handler4_common, which is exported from ucrtbase.dll in 32-bit Windows. Also revert dependent changes r359362 and r359466. llvm-svn: 359611
* [sanitizer] Calculate SizeClassAllocator32::ByteMap type from ↵Vitaly Buka2019-04-271-8/+3
| | | | | | | | | | | | | | Params::kSpaceSize and Params::kRegionSizeLog Reviewers: eugenis Subscribers: kubamracek, cryptoad, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61206 llvm-svn: 359374
* [NFC][Sanitizer] Remove GetRealFunctionAddress and replace usagesJulian Lettner2019-04-271-17/+7
| | | | | | | | Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D61205 llvm-svn: 359362
* [NFC] Remove ::kForTest from AP64, it does not use it.Vitaly Buka2019-04-261-1/+1
| | | | llvm-svn: 359323
* [lsan] Use SANITIZER_WORDSIZE when selecting ByteMapVitaly Buka2019-04-261-2/+2
| | | | | | | Originally this code was added for 64-bit platform and it was never update. Add static_assert to validate type of ByteMap. llvm-svn: 359286
* Revert "[lsan] Use SANITIZER_WORDSIZE when selecting ByteMap"Vitaly Buka2019-04-261-2/+2
| | | | | | | | New static_assert fails on a bot. This reverts commit r359269. llvm-svn: 359276
* [lsan] Use SANITIZER_WORDSIZE when selecting ByteMapVitaly Buka2019-04-261-2/+2
| | | | | | | Originally this code as added for 64-bit platform and was never changed. Add static_assert to make sure that we have correct map on all platforms. llvm-svn: 359269
* [TSan] Support fiber API on macOSJulian Lettner2019-04-206-22/+56
| | | | | | | | | | | | | | Committing on behalf of Yuri Per (yuri). Reviewers: dvyukov, kubamracek, yln Reviewed By: kubamracek Authored By: yuri Differential Revision: https://reviews.llvm.org/D58110 llvm-svn: 358802
* [TSan][libdispatch] Avoid infinite recursion in dispatch_apply[_f] interceptorsJulian Lettner2019-03-191-9/+29
| | | | | | | | | | | | | | | | | In libdispatch, dispatch_apply is implemented in terms of dispatch_apply_f. Unfortunately, this means that we can't implement the interceptor for dispatch_apply_f by forwarding to the dispatch_apply interceptor. In the interceptor dispatch_apply_f, we can't use WRAP(dispatch_apply). WRAP(dispatch_apply) -> REAL(dispatch_apply_f). Requires duplication of some setup code. Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D59526 llvm-svn: 356467
* [TSan][libdispatch] Remove dependency on system headersJulian Lettner2019-03-142-15/+75
| | | | | | | | | | | | | | | | | | | | | | | Including <dispatch/dispatch.h> and <Blocks.h> transitively pulls in other system headers. Let's try to avoid that. Blocks.h: compiler-rt already includes a blocks runtime. Just use the header file that comes with it. dispatch.h: Declare the bare minimum required for our implementation, i.e., everything needed to define the interceptors, but not the interceptors themselves. See tsan_dispatch_defs.h. I spotted a few other places in compile-rt, where we declare libdispatch types. Maybe this file can be moved to sanitizer_common if we deem it useful enough. tsan_libdispatch.cc now compiles on Linux/Clang (requires support for -fblocks). Linking still requires some manual configuration. Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D59145 llvm-svn: 356201
* [TSan] Initialize libdispatch interceptors if necessaryJulian Lettner2019-03-082-0/+46
| | | | | | | | | | | | On Linux (and other non-Darwin platforms) we need to initialize interceptors. Since tsan_libdispatch.cc is compiled optionally, add a weak default implementation of `InitializeLibdispatchInterceptors`. Reviewed By: dvyukov Differential Revision: https://reviews.llvm.org/D59113 llvm-svn: 355717
* [NFC][TSan] Remove unnecessary #includeJulian Lettner2019-03-071-1/+0
| | | | llvm-svn: 355620
* [TSan][Linux] Fix libdispatch interception macros compilation errorsJulian Lettner2019-03-071-10/+16
| | | | | | | | | | | | | | | | | | | Most libdispatch functions come in two variants: callbacks can be specified via blocks or function pointers. Some of our interceptors for the block variant actually forward to the function variant. However, on Linux, `DECLARE_REAL(name)` has to appear before `REAL(name)`. This patch reorders _f variant interceptors before _b variants where possible and forward declares the _f variant in the remaining cases (cyclic dependency between _f and _b interceptors). Also rename macro to DISPATCH_INTERCEPT_ASYNC_F for better consistency. Reviewed By: dvyukov Differential Revision: https://reviews.llvm.org/D59067 llvm-svn: 355619
* [NFC][TSan][libdispatch] Rename tsan_block_context_t -> block_context_tJulian Lettner2019-03-061-29/+27
| | | | | | | 'tsan_' part of the struct name is redundant since we are already inside the __tsan namespace. llvm-svn: 355539
* [tsan] Support interception of libdispatch on LinuxJulian Lettner2019-03-061-6/+3
| | | | | | | | | | | | | | | | | | | | | | | This is a new attempt for bringing TSan libdispatch support to Linux. The main issue with the last patch (https://reviews.llvm.org/D53171) was that we want to avoid building a separate library. The updated plan is as follows: 1) Hide libdispatch support behind a flag: true on Darwin, false elsewhere. If flag is specified, assume that libdispatch header and -flbocks is available for building. This way we can directly include the libdispatch header and rely on blocks runtime for our implementation. 2) Optionally/weakly intercept libdispatch API functions. This patch accomplishes 1). It compiles (without the flag enabled) on Linux. Follow-up patches will provide 2) and enabling of tests on Linux. Reviewed By: dvyukov Differential Revision: https://reviews.llvm.org/D58935 llvm-svn: 355538
* [NFC][Sanitizer] Make GetStackTrace a private method of BufferedStackTraceJulian Lettner2019-03-011-7/+6
| | | | | | | | | | GetStackTrace is a implementation detail of BufferedStackTrace. Make it a private method. Reviewed By: vitalybuka Differential-Revision: https://reviews.llvm.org/D58753 llvm-svn: 355232
* [NFC][Sanitizer] Add new BufferedStackTrace::Unwind APIJulian Lettner2019-03-012-17/+5
| | | | | | | | | | | | | | | | | | | | | Retrying without replacing call sites in sanitizer_common (which might not have a symbol definition). Add new Unwind API. This is the final envisioned API with the correct abstraction level. It hides/slow fast unwinder selection from the caller and doesn't take any arguments that would leak that abstraction (i.e., arguments like stack_top/stack_bottom). GetStackTrace will become an implementation detail (private method) of the BufferedStackTrace class. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58741 > llvm-svn: 355168 llvm-svn: 355172
* Revert "[NFC][Sanitizer] Add new BufferedStackTrace::Unwind API"Julian Lettner2019-03-012-5/+17
| | | | | | This reverts commit 6112f37e758ebf2405955e091a745f5003c1f562. llvm-svn: 355171
* [NFC][Sanitizer] Add new BufferedStackTrace::Unwind APIJulian Lettner2019-03-012-17/+5
| | | | | | | | | | | | | | | | Add new Unwind API. This is the final envisioned API with the correct abstraction level. It hides/slow fast unwinder selection from the caller and doesn't take any arguments that would leak that abstraction (i.e., arguments like stack_top/stack_bottom). GetStackTrace will become an implementation detail (private method) of the BufferedStackTrace class. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58741 llvm-svn: 355168
* [NFC][TSan] Don't define GetStackTrace when compiling for GoJulian Lettner2019-02-281-0/+2
| | | | | | rdar://48455255 llvm-svn: 355053
* [NFC][Sanitizer] Pull up GetStackTrace into sanitizer_commonJulian Lettner2019-02-271-0/+12
| | | | | | | | | | | | | | | | | | | | We already independently declare GetStackTrace in all (except TSan) sanitizer runtime headers. Lets move it to sanitizer_stacktrace.h to have one canonical way to fill in a BufferedStackFrame. Also enables us to use it in sanitizer_common itself. This patch defines GetStackTrace for TSan and moves the function from ubsan_diag.cc to ubsan_diag_standalone.cc to avoid duplicate symbols for the UBSan-ASan runtime. Other than that this patch just moves the code out of headers and into the correct namespace. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58651 llvm-svn: 355039
* [NFC][Sanitizer] Hard-code fast/slow unwinder at call siteJulian Lettner2019-02-272-7/+10
| | | | | | | | | | | | | Also assert that the caller always gets what it requested. This purely mechanical change simplifies future refactorings and eventual removal of BufferedStackTrace::Unwind. Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58557 llvm-svn: 355022
* [Sanitizer] Add interceptor for pthread_sigmaskPavel Labath2019-02-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: pthread_sigmask is just like sigprocmask, except that its behavior in multithreaded programs is explicitly specified. Sanitizers were lacking a common interceptor for pthread_sigmask (although some specific sanitizers defined custom version), which lead to false positives (at least in msan) when using this function. The interceptor implementation, and its test are based on the equivalent code for sigprocmask. Reviewers: eugenis, vitalybuka Subscribers: kubamracek, delcypher, jfb, jdoerfert, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58382 llvm-svn: 354874
* [Sanitizer] Fix uses of stack->Unwind(..., fast)Julian Lettner2019-02-221-1/+2
| | | | | | | | | | | Apply StackTrace::WillUseFastUnwind(fast) in a few more places missed by my previous patch (https://reviews.llvm.org/D58156). Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58550 llvm-svn: 354695
* [sanitizer] Common macro for .note.GNU-stack directives (NFC)Evgeniy Stepanov2019-02-212-9/+2
| | | | llvm-svn: 354632
* [Sanitizer] On Darwin `__sanitizer_print_stack_trace` only prints topmost frameJulian Lettner2019-02-181-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In compiler-rt we have the notion of a `fast` and a `slow` stack unwinder. Darwin currently only supports the fast unwinder. From reading the code, my understanding is that `BufferedStackTrace::Unwind` can be called with `bp=0, stack_top=0, stack_bottom=0, request_fast_unwind=false`. If `request_fast_unwind=true`, then we alos need to supply bp, stack_top, and stack_bottom. However, `BufferedStackTrace::Unwind` uses `StackTrace::WillUseFastUnwind` which will adapt `request_fast_unwind` if the requested unwinder is not supported. On Darwin, the result is that we don't pass actual values for bp, stack_top, and stack_bottom, but end up using the fast unwinder. The tests then fail because we only print the topmost stack frame. This patch adds a check to `WillUseFastUnwind` at the point of usage to avoid the mismatch between `request_fast_unwind` and what `Unwind` actually does. I am also interested in cleaning up the `request_fast_unwind` machinery so this patch just the simplest thing possible so I can enable the tests. Reviewers: vitalybuka, vsk Differential Revision: https://reviews.llvm.org/D58156 llvm-svn: 354282
* Dmitry Vyukov2019-02-135-3/+98
| | | | | | | | | | | | | | | | | | | | | | | tsan: add fiber support This patch adds functions for managing fibers: __tsan_get_current_fiber() __tsan_create_fiber() __tsan_destroy_fiber() __tsan_switch_to_fiber() __tsan_set_fiber_name() See the added tests for use examples. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D54889 [The previous commit of this change was reverted, this is a resubmit with a squashed fix for check_analyze.sh and COMMON_INTERCEPTOR_NOTHING_IS_INITIALIZED] llvm-svn: 353947
* Revert "tsan: add fiber support"Diana Picus2019-02-135-97/+2
| | | | | | | This reverts commit r353817 because we think it broke AARch64 and PowerPC buildbots. llvm-svn: 353939
* [tsan] #undef one-letter macrosEvgeniy Stepanov2019-02-121-0/+8
| | | | | | | | buildgo.sh puts most of sanitizer_common together in a single source file. These single-letter macros end up affecting a lot of unrelated code; #undef them as early as possible. llvm-svn: 353902
* tsan: add fiber supportDmitry Vyukov2019-02-125-2/+97
| | | | | | | | | | | | | | | | | This patch adds functions for managing fibers: __tsan_get_current_fiber() __tsan_create_fiber() __tsan_destroy_fiber() __tsan_switch_to_fiber() __tsan_set_fiber_name() See the added tests for use examples. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D54889 llvm-svn: 353817
* tsan: Introduce in_symbolizer() function for Thread sanitizerDmitry Vyukov2019-02-124-22/+28
| | | | | | | | | This change is preparation for fiber support. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D58104 llvm-svn: 353805
* tsan: Implement pthread_exit() interceptor for Thread sanitizerVitaly Buka2019-02-091-0/+8
| | | | | | | | | | | | This change is preparation for fiber support. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D57876 Context: https://reviews.llvm.org/D54889 > llvm-svn: 353385 llvm-svn: 353627
* [tsan] Remove pthread_exit interceptorVitaly Buka2019-02-091-8/+0
| | | | | | Crashes PPC bot llvm-svn: 353604
* Fix Die() after pthread_exit call on macOSVitaly Buka2019-02-081-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: Scoped interceptor should not be used when calling real pthread_exit(). On macOS C++ destructors are not called by pthread_exit(), and later check for empty thread ignore set fails. Patch by Yuri Per. Reviewers: dvyukov, vitalybuka Reviewed By: vitalybuka Subscribers: vitalybuka, thegameg, kubamracek, jfb, llvm-commits, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D57963 llvm-svn: 353561
* [tsan] Remove SCOPED_TSAN_INTERCEPTOR to try to fix ppc botVitaly Buka2019-02-081-1/+0
| | | | llvm-svn: 353552
* tsan: Optimize performance of Thread sanitizer memory access functionsDmitry Vyukov2019-02-073-14/+31
| | | | | | | | | | | | | | | | - Manually unwind code in MemoryAccessImpl1() because clang do not optimize it - Check for .rodata section only in read operations - Place LIKELY/UNLIKELY on fast paths This speeds up synthetic memory access benchmarks by 10-20%. [dvyukov: fixed up consts in check_analyze.sh] Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D57882 Context: https://reviews.llvm.org/D54889 llvm-svn: 353401
* sanitizers: Introduce ThreadType enumDmitry Vyukov2019-02-078-9/+12
| | | | | | | | | | | | | Replace bool workerthread flag with ThreadType enum. This change is preparation for fiber support. [dvyukov: fixed build of sanitizer_thread_registry_test.cc] Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D57839 Context: https://reviews.llvm.org/D54889 llvm-svn: 353390
* tsan: Implement pthread_exit() interceptor for Thread sanitizerDmitry Vyukov2019-02-071-0/+6
| | | | | | | | | | This change is preparation for fiber support. Author: yuri (Yuri Per) Reviewed in: https://reviews.llvm.org/D57876 Context: https://reviews.llvm.org/D54889 llvm-svn: 353385
* [sanitizer] Don't unpoison buffer in getpw/getgr functionsVitaly Buka2019-02-071-13/+0
| | | | | | | | | | | | | | | | | Summary: Buffer should be referenced by results so used parts will be unpoisoned with unpoison_group and unpoison_passwd. This fixes TSAN performance issue made us to disable this interceptors. Reviewers: eugenis, dvyukov Subscribers: srhines, kubamracek, krytarowski, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D57731 llvm-svn: 353351
* [tsan] Disable fgetpwent_r to work around performance issuesVitaly Buka2019-02-041-0/+1
| | | | | | This was missed from D54041 when SANITIZER_INTERCEPT_FGETPWENT_R was branched from SANITIZER_INTERCEPT_GETPWENT_R llvm-svn: 353110
* Adjust documentation for git migration.James Y Knight2019-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes most references to the paths: llvm.org/svn/ llvm.org/git/ llvm.org/viewvc/ github.com/llvm-mirror/ github.com/llvm-project/ reviews.llvm.org/diffusion/ to instead point to https://github.com/llvm/llvm-project. This is *not* a trivial substitution, because additionally, all the checkout instructions had to be migrated to instruct users on how to use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of checking out various projects into various subdirectories. I've attempted to not change any scripts here, only documentation. The scripts will have to be addressed separately. Additionally, I've deleted one document which appeared to be outdated and unneeded: lldb/docs/building-with-debug-llvm.txt Differential Revision: https://reviews.llvm.org/D57330 llvm-svn: 352514
* On Darwin add allocator address and size fields toDan Liew2019-01-211-0/+1
| | | | | | | | | | | | | | `sanitizer_malloc_introspection_t` and initialize them to zero. We allow sanitizer implementations to perform different initialization by defining `COMMON_MALLOC_HAS_EXTRA_INTROSPECTION_INIT` to be `1` and providing an implementation of `mi_extra_init(...)`. We use these changes in future patches to implement malloc zone enumeration. rdar://problem/45284065 llvm-svn: 351712
* On Darwin allow for sanitizer malloc implementations to provide a zoneDan Liew2019-01-211-0/+1
| | | | | | | | | | | | | | | | enumerator. This is done by defining `COMMON_MALLOC_HAS_ZONE_ENUMERATOR` to `1` and then by providing an implementation of the `mi_enumerator(...)` function. If a custom implementation isn't desired the macro is set to `0` which causes a stub version (that fails) to be used. Currently all Darwin sanitizers that have malloc implementations define this to be `0` so there is no functionality change. rdar://problem/45284065 llvm-svn: 351711
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1959-236/+177
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [TSan] Use switches when dealing with enumsJulian Lettner2019-01-163-86/+87
| | | | | | | | | | | | | | | | | | Summary: Small refactoring: replace some if-else cascades with switches so that the compiler warns us about missing cases. Maybe found a small bug? Reviewers: dcoughlin, kubamracek, dvyukov, delcypher, jfb Reviewed By: dvyukov Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D56295 llvm-svn: 351288
OpenPOWER on IntegriCloud