summaryrefslogtreecommitdiffstats
path: root/compiler-rt
Commit message (Collapse)AuthorAgeFilesLines
...
* [XRay] Use uptr instead of uintptr_tDean Michael Berris2018-12-051-8/+8
| | | | | | Follow-up to D54989. llvm-svn: 348338
* [XRay] Use deallocateBuffer instead of deallocateDean Michael Berris2018-12-051-16/+16
| | | | | | Follow-up to D54989. llvm-svn: 348336
* [XRay] Move-only Allocator, FunctionCallTrie, and ArrayDean Michael Berris2018-12-057-377/+887
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change makes the allocator and function call trie implementations move-aware and remove the FunctionCallTrie's reliance on a heap-allocated set of allocators. The change makes it possible to always have storage associated with Allocator instances, not necessarily having heap-allocated memory obtainable from these allocator instances. We also use thread-local uninitialised storage. We've also re-worked the segmented array implementation to have more precondition and post-condition checks when built in debug mode. This enables us to better implement some of the operations with surrounding documentation as well. The `trim` algorithm now has more documentation on the implementation, reducing the requirement to handle special conditions, and being more rigorous on the computations involved. In this change we also introduce an initialisation guard, through which we prevent an initialisation operation from racing with a cleanup operation. We also ensure that the ThreadTries array is not destroyed while copies into the elements are still being performed by other threads submitting profiles. Note that this change still has an issue with accessing thread-local storage from signal handlers that are instrumented with XRay. We also learn that with the testing of this patch, that there will be cases where calls to mmap(...) (through internal_mmap(...)) might be called in signal handlers, but are not async-signal-safe. Subsequent patches will address this, by re-using the `BufferQueue` type used in the FDR mode implementation for pre-allocated memory segments per active, tracing thread. We still want to land this change despite the known issues, with fixes forthcoming. Reviewers: mboerger, jfb Subscribers: jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D54989 llvm-svn: 348335
* Update GET_LINK_MAP_BY_DLOPEN_HANDLE() for NetBSD x86Kamil Rytarowski2018-12-051-2/+2
| | | | | | | | | | NetBSD 8.99.26 changed the layout of internal structure returned by dlopen(3), switch to it. Set new values for amd64 and i386 based on the results of &((struct Struct_Obj_Entry*)0)->linkmap. llvm-svn: 348329
* [asan] Add clang flag -fsanitize-address-use-odr-indicatorVitaly Buka2018-12-051-0/+5
| | | | | | | | | | Reviewers: eugenis, m.ostapenko, ygribov Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D55157 llvm-svn: 348327
* [asan] Split -asan-use-private-alias to -asan-use-odr-indicatorVitaly Buka2018-12-041-1/+6
| | | | | | | | | | Reviewers: eugenis, m.ostapenko, ygribov Subscribers: mehdi_amini, kubamracek, hiraditya, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D55156 llvm-svn: 348316
* [asan] Remove use_odr_indicator runtime flagVitaly Buka2018-12-045-11/+5
| | | | | | | | | | | | | | Summary: Flag was added for testing 3 years ago. Probably it's time to simplify code and usage by removing it. Reviewers: eugenis, m.ostapenko Subscribers: mehdi_amini, kubamracek, steven_wu, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D55254 llvm-svn: 348315
* Fix sanitizer unit testDavid Carlier2018-12-041-1/+1
| | | | llvm-svn: 348297
* Unbreak build due to style.David Carlier2018-12-041-1/+2
| | | | llvm-svn: 348295
* [Sanitizer] intercept part of sysctl ApiDavid Carlier2018-12-044-57/+92
| | | | | | | | | | | | | - Distringuish what FreeBSD/NetBSD can and NetBSD specifics. - Fixing page size value collection. Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55265 llvm-svn: 348293
* [SanitizerCommon] Test `CombinedAllocator::ForEachChunk()` in unit tests.Dan Liew2018-12-041-0/+16
| | | | | | | | | | | | | | Summary: Previously we weren't testing this function in the unit tests. Reviewers: kcc, cryptoad, dvyukov, eugenis, kubamracek Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D54861 llvm-svn: 348260
* [compiler-rt] Use the new zx_futex_wait for Fuchsia sanitizer runtimePetr Hosek2018-12-041-2/+3
| | | | | | | | | This finishes the soft-transition to the new primitive that implements priority inheritance. Differential Revision: https://reviews.llvm.org/D55244 llvm-svn: 348236
* Improve the regerror(3) interceptorKamil Rytarowski2018-12-041-2/+2
| | | | | | | | | The res returned value might differ with REAL(strlen)(errbuf) + 1, as the buffer's value is limited with errbuf_size. Hot fix for D54584. llvm-svn: 348231
* Add interceptors for the sysctl(3) API family from NetBSDKamil Rytarowski2018-12-043-0/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add new interceptors for: - sysctl - sysctlbyname - sysctlgetmibinfo - sysctlnametomib - asysctl - asysctlbyname Cover the API with a new test file TestCases/NetBSD/sysctl.cc. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: devnexen, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54076 llvm-svn: 348228
* Add interceptors for the fts(3) API family from NetBSDKamil Rytarowski2018-12-045-0/+120
| | | | | | | | | | | | | | | | | | | | | | | Summary: fts(3) is API to traverse a file hierarchy. Cover this interface with interceptors. Add a test to validate the interface reading the number of regular files in /etc. Based on original work by Yang Zheng. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54247 llvm-svn: 348227
* Add new interceptor for regex(3) in NetBSDKamil Rytarowski2018-12-045-0/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Add interceptors for the NetBSD style of regex(3) present inside libc: - regcomp - regexec - regerror - regfree - regnsub - regasub Add a dedicated test verifying the installed interceptors. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54584 llvm-svn: 348224
* [gcov/Darwin] Ensure external symbols are exported when using an export listVedant Kumar2018-12-031-0/+8
| | | | | | | | | | | | | | Make sure that symbols needed to implement runtime support for gcov are exported when using an export list on Darwin. Without the clang driver exporting these symbols, the linker hides them, resulting in tapi verification failures. rdar://45944768 Differential Revision: https://reviews.llvm.org/D55151 llvm-svn: 348187
* [SanitizerCommon] Remove RenameFileEugene Leviant2018-12-034-17/+0
| | | | | | | | | This function seems to be no longer used by compiler-rt libraries Differential revision: https://reviews.llvm.org/D55123 llvm-svn: 348140
* Introduce a way to allow the ASan dylib on Darwin platforms to be loaded via ↵Dan Liew2018-12-0110-1/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `dlopen()`. Summary: The purpose of this option is provide a way for the ASan dylib to be loaded via `dlopen()` without triggering most initialization steps (e.g. shadow memory set up) that normally occur when the ASan dylib is loaded. This new functionality is exposed by - A `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` macro which indicates if the feature is supported. This only true for Darwin currently. - A `HandleDlopenInit()` function which should return true if the library is being loaded via `dlopen()` and `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` is supported. Platforms that support this may perform any initialization they wish inside this function. Although disabling initialization is something that could potentially apply to other sanitizers it appears to be unnecessary for other sanitizers so this patch only makes the change for ASan. rdar://problem/45284065 Reviewers: kubamracek, george.karpenkov, kcc, eugenis, krytarowski Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D54469 llvm-svn: 348078
* [compiler-rt] Use "ColumnLimit: 0" instead of "clang-format off" in testsVitaly Buka2018-12-017-12/+2
| | | | | | | | | | Reviewers: eugenis, jfb Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D55152 llvm-svn: 348061
* Add a new interceptor for getvfsstat(2) from NetBSDKamil Rytarowski2018-11-303-0/+52
| | | | | | | | | | | | | | | | | | | Summary: getvfsstat - gets list of all mounted file systems. Add a dedicated test. Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55014 llvm-svn: 348027
* Revert r346560 "[winasan] Unpoison the stack in NtTerminateThread"Reid Kleckner2018-11-292-12/+1
| | | | | | | | | | | This reverts r343606 again. The NtTerminateThread interceptor is causing problems in NaCl: https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/CrWinAsan/1839 I reproduced the problem locally and tried my best to debug them, but it's beyond me. llvm-svn: 347933
* (no commit message)Julian Lettner2018-11-281-1/+1
| | | | llvm-svn: 347788
* [gcov] Disable instrprof-gcov-fork.test.Matt Morehouse2018-11-281-0/+2
| | | | | | Test has been flaky for over a week and author hasn't fixed. llvm-svn: 347779
* [CMake] Add a missing case of TO_CMAKE_PATHMartin Storsjo2018-11-271-0/+1
| | | | | | This fixes building sanitizers for mingw natively. llvm-svn: 347646
* Fix filtering of sanitizer_common unittest architectures on Darwin.Kuba Mracek2018-11-271-1/+1
| | | | llvm-svn: 347622
* [X86][compiler-rt] Add missing semicolonBenjamin Kramer2018-11-241-1/+1
| | | | llvm-svn: 347519
* [X86] Make conversion of feature bits into a mask explicitly unsigned by ↵Craig Topper2018-11-241-6/+6
| | | | | | using 1U instead of 1. llvm-svn: 347517
* [X86][compiler-rt] Attempt to fix a warning about a shift amount being ↵Craig Topper2018-11-241-6/+6
| | | | | | negative in a macro expansion. llvm-svn: 347516
* Unbreak FreeBSD build.David Carlier2018-11-221-0/+1
| | | | | | M lib/sanitizer_common/sanitizer_platform_limits_posix.cc llvm-svn: 347451
* [XRay] Support for FuchsiaPetr Hosek2018-11-2212-22/+259
| | | | | | | | This extends XRay to support Fuchsia. Differential Revision: https://reviews.llvm.org/D52162 llvm-svn: 347443
* tsan: Update measurements in check_analyze.sh.Peter Collingbourne2018-11-221-2/+2
| | | | | | | | | These changed as a result of r347379. Unfortunately there was a regression; filed PR39748 to track it. Differential Revision: https://reviews.llvm.org/D54821 llvm-svn: 347442
* tsan: Correct the name of an executable.Peter Collingbourne2018-11-221-1/+1
| | | | llvm-svn: 347439
* [Sanitizer] Adding setvbuf in supported platforms and other stream buffer ↵David Carlier2018-11-217-2/+60
| | | | | | | | | | | | | | | functions - Enabling setvbuf interceptions for non NetBSD platforms. - setbuf, setbuffer, setlinebuf as well. Reviewers: vitalybuka, krytarowski Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D54779 llvm-svn: 347426
* [compiler-rt][UBSan] silence_unsigned_overflow: do *NOT* ignore *fatal* ↵Roman Lebedev2018-11-213-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unsigned overflows Summary: D48660 / rL335762 added a `silence_unsigned_overflow` env flag for [[ https://github.com/google/oss-fuzz/pull/1717 | oss-fuzz needs ]], that allows to silence the reports from unsigned overflows. It makes sense, it is there because `-fsanitize=integer` sanitizer is not enabled on oss-fuzz, so this allows to still use it as an interestingness signal, without getting the actual reports. However there is a slight problem here. All types of unsigned overflows are ignored. Even if `-fno-sanitize-recover=unsigned` was used (which means the program will die after the report) there will still be no report, the program will just silently die. At the moment there are just two projects on oss-fuzz that care: * [[ https://github.com/google/oss-fuzz/blob/8eeffa627f937040aaf8ba1b7d93f43f77d74fb9/projects/llvm_libcxx/build.sh#L18-L20 | libc++ ]] * [[ https://github.com/google/oss-fuzz/blob/8eeffa627f937040aaf8ba1b7d93f43f77d74fb9/projects/librawspeed/build.sh | RawSpeed ]] (me) I suppose this could be overridden there ^, but i really don't think this is intended behavior in any case.. Reviewers: kcc, Dor1s, #sanitizers, filcab, vsk, kubamracek Reviewed By: Dor1s Subscribers: dberris, mclow.lists, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54771 llvm-svn: 347415
* tsan: add pthread_tryjoin_np and pthread_timedjoin_np interceptorsDmitry Vyukov2018-11-217-0/+132
| | | | | | | | | | Add pthread_tryjoin_np() and pthread_timedjoin_np() interceptors on Linux, so that ThreadSanitizer can handle programs using these functions. Author: Yuri Per (yuri) Reviewed in: https://reviews.llvm.org/D54521 llvm-svn: 347383
* Add header <atomic> which is needed to compile with some older library versions.Douglas Yung2018-11-211-0/+1
| | | | llvm-svn: 347382
* [XRay] Add a test for re-initialising FDR mode (NFC)Dean Michael Berris2018-11-211-0/+72
| | | | | | | This change adds an end-to-end test that ensures FDR mode can be re-initialised safely in the face of multiple threads being traced. llvm-svn: 347368
* Revert "[Sanitizer] intercept setvbuf on other platforms where it is supported"David Carlier2018-11-203-12/+1
| | | | llvm-svn: 347358
* [Sanitizer] Unbreak non NetBSD builds.David Carlier2018-11-201-0/+2
| | | | llvm-svn: 347357
* [Sanitizer] intercept setvbuf on other platforms where it is supportedDavid Carlier2018-11-203-3/+10
| | | | | | | | | | | | Unit tests enabled only in platform tested. Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski, vitalybuka Differential Revision: https://reviews.llvm.org/D54739 llvm-svn: 347355
* [cmake] Fix detecting terminfo libraryMichal Gorny2018-11-201-3/+5
| | | | | | | | | | | | | | | | | | Copy the fix for determining the correct terminfo library from LLVM -- use distinct variables for check_library_exists() calls. Otherwise, the first check (for -ltinfo) populates the variable and no other checks are performed. Effectively, systems with other libraries than the first one listed are presumed not to have terminfo routines at all. Also sync the check order to include the NetBSD fix from r347156. This partially fixes undefined symbols when linking XRay tests. It's probably not the best solution to the problem there but as long as the terminfo check stays in config-ix, I thnk it's worth fixing. Differential Revision: https://reviews.llvm.org/D54641 llvm-svn: 347338
* [tsan] Add __cxa_guard_acquire hooks to support cooperative schedulingVitaly Buka2018-11-202-0/+37
| | | | | | | | | | Reviewers: dvyukov Subscribers: krytarowski, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D54664 llvm-svn: 347336
* [XRay] Add a test for allocator exhaustionDean Michael Berris2018-11-202-8/+27
| | | | | | | | Use a more representative test of allocating small chunks for oddly-sized (small) objects from an allocator that has a page's worth of memory. llvm-svn: 347286
* [XRay] Move buffer extents back to the heapDean Michael Berris2018-11-206-22/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change addresses an issue which shows up with the synchronised race between threads writing into a buffer, and another thread reading the buffer. In a lot of cases, we cannot guarantee that threads will always see the signal to finalise their buffers in time despite the grace periods and state machine maintained through atomic variables. This change addresses it by ensuring that the same instance being updated to indicate how much of the buffer is "used" by the writing thread is the same instance being read by the thread processing the buffer to be written out to disk or handled through the iterators. To do this, we ensure that all the "extents" instances live in their own the backing store, in a different contiguous page from the buffer-specific backing store. We also take precautions to ensure that the atomic variables are cache-line-sized to prevent false-sharing from unnecessarily causing cache contention on unrelated writes/reads. It's feasible that we may in the future be able to move the storage of the extents objects into the single backing store, slightly changing the way to compute the size(s) of the buffers, but in the meantime we'll settle for the isolation afforded by having a different backing store for the extents instances. Reviewers: mboerger Subscribers: jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D54684 llvm-svn: 347280
* [compiler-rt] Use zx_futex_wait_deprecated for Fuchsia sanitizer runtimePetr Hosek2018-11-201-2/+2
| | | | | | | | | This change is part of the soft-transition to the new synchronization primitives which implement priority inheritance. Differential Revision: https://reviews.llvm.org/D54727 llvm-svn: 347279
* Add interceptor for the setvbuf(3) from NetBSDKamil Rytarowski2018-11-193-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | Summary: setvbuf(3) is a routine to setup stream buffering. Enable the interceptor for NetBSD. Add dedicated tests for setvbuf(3) and functions on top of this interface: setbuf, setbuffer, setlinebuf. Based on original work by Yang Zheng. Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: devnexen, tomsun.0.7, kubamracek, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D54548 llvm-svn: 347270
* [hwasan] don't check tail magic when in right_align mode (should fix the bot)Kostya Serebryany2018-11-171-1/+1
| | | | llvm-svn: 347121
* [hwasan] make the heap-buffer-overflow.c test more robust and re-enable it. ↵Kostya Serebryany2018-11-171-3/+3
| | | | | | With malloc_align_right the relative offsets of heap chunks are less predictable to simply don't test for them. llvm-svn: 347118
* [hwasan] implement free_checks_tail_magic=1Kostya Serebryany2018-11-175-1/+114
| | | | | | | | | | | | | | | | | | | | | | | Summary: With free_checks_tail_magic=1 (default) HWASAN writes magic bytes to the tail of every heap allocation (last bytes of the last granule, if the last granule is not fully used) and checks these bytes on free(). This feature will detect buffer overwires within the last granule at the time of free(). This is an alternative to malloc_align_right=[1289] that should have fewer compatibility issues. It is also weaker since it doesn't detect read overflows and reports bugs at free() instead of at access. Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D54656 llvm-svn: 347116
OpenPOWER on IntegriCloud