summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2017-10-02[cmake] Add a separate CMake var to control profile runtimeMichal Gorny
Make it possible to control building profile runtime separately from other options. Before r313549, the profile runtime building was controlled along with sanitizers. However, since that commit it is built unconditionally which results in multiple builds for people building different runtimes separately. Differential Revision: https://reviews.llvm.org/D38441 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314646 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29Move LoadedModule list to a NoCtor vector and initialize on demand.Francis Ricci
Unreverting this patch because llvm-clang-lld-x86_64-debian-fast started passing again before the revert hit. Must've been just a flake. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314556 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29Revert "Move LoadedModule list to a NoCtor vector and initialize on demand."Francis Ricci
I think this may have introduced a failure on llvm-clang-lld-x86_64-debian-fast This reverts commit r314533 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314552 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29Move LoadedModule list to a NoCtor vector and initialize on demand.Francis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314533 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29Add missing header definitionFrancis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314521 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29Remove recursion from FindModuleForAddress. NFC.Francis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314520 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29Refactor android fallback procmaps init. NFC.Francis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-29[XRay][compiler-rt][NFC] Remove loggingInitialized() convenience functionDean Michael Berris
The function was introduced as a convenience that used to be called in multiple places. Recent refactorings have removed the need to call this function in multiple places, so inlined the implementation in the single place it's defined. Broken out from D38119. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28Revert "Add support for custom loaders to the sanitizer symbolizer"Francis Ricci
This causes the gcc sanitizer buildbot to timeout. This reverts commit 81f388fe570e5b6460dd5bc9b9a36b72714eeb68. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314453 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[asan] Fix the bug number in the error message.Evgeniy Stepanov
The link in the "Shadow memory range interleaves with an existing memory mapping" error message was pointing to the wrong bug. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314441 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28Add support for custom loaders to the sanitizer symbolizerFrancis Ricci
Summary: Adds a fallback mode to procmaps when the symbolizer fails to locate a module for a given address by using dl_iterate_phdr. Reviewers: kubamracek, rnk, vitalybuka, eugenis Reviewed By: eugenis Subscribers: srhines, llvm-commits Differential Revision: https://reviews.llvm.org/D37269 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[asan] Unpoison global metadata on dlclose.Benjamin Kramer
dlclose itself might touch it, so better return it to the state it was before. I don't know how to create a test for this as it would require chaning dlclose itself. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314415 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28tsan: handle signals in pause callDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314384 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[XRay] [compiler-rt] FDR logging arg1 handlerMartin Pelikan
Summary: Write out records about logged function call first arguments. D32840 implements the reading of this in llvm-xray. Reviewers: dberris Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32844 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314378 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-28[ubsan] Merge ubsan_standalone_cxx shared library.Evgeniy Stepanov
Summary: Link everything, including the C++ bits, in the single ubsan_standalone SHARED library. This matches ASan setup. Reviewers: vitalybuka Subscribers: kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D38340 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314369 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27ASan allocates a global data initialization array at the tail end of eachDmitry Mikulin
compunit's .data section. This vector is not poisoned. Because of this the first symbol of the following section has no left red zone. As a result, ASan cannot detect underflow for such symbols. Poison ASan allocated metadata, it should not be accessible to user code. This fix does not eliminate the problem with missing left red zones but it reduces the set of vulnerable symbols from first symbols in each input data section to first symbols in the output section of the binary. Differential Revision: https://reviews.llvm.org/D38056 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27Revert "Add support for custom loaders to symbolizer"Francis Ricci
This broke the windows buildbots, revert for now. This reverts commit 24050b5ddef42f6f3306aa94d4a1f42a7893a9a7. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27Add support for custom loaders to symbolizerFrancis Ricci
Change-Id: I5594bd6b216deca2c73cf0a7001f9aec1e803c60 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314342 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[builtins] ARM: Revert r314284, r314285 and r314289Manoj Gupta
Revert r314284, r314285 and r314289 because of a reported breakage in armv7k watchos builder. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314333 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[ARM] builtins: Replace abort by assert in clear_cache.Manoj Gupta
Summary: __builtion___clear_cache maps to clear_cache function. On Linux, clear_cache functions makes a syscall and does an abort if syscall fails. Replace the abort by an assert so that non-debug builds do not abort if the syscall fails. Fixes PR34588. Reviewers: rengolin, compnerd, srhines, peter.smith, joerg Reviewed By: rengolin Subscribers: aemerson, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D37788 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314322 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[Sanitizer] Disable compact size class tests on AndroidAlex Shlyapnikov
Fixing test failure on Android introduced in D38245. Compact size class maps defined there are not to be used on Android. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314318 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[Sanitizers] Allocator: new "release memory to OS" implementationAlex Shlyapnikov
Summary: The current implementation of the allocator returning freed memory back to OS (controlled by allocator_release_to_os_interval_ms flag) requires sorting of the free chunks list, which has two major issues, first, when free list grows to millions of chunks, sorting, even the fastest one, is just too slow, and second, sorting chunks in place is unacceptable for Scudo allocator as it makes allocations more predictable and less secure. The proposed approach is linear in complexity (altough requires quite a bit more temporary memory). The idea is to count the number of free chunks on each memory page and release pages containing free chunks only. It requires one iteration over the free list of chunks and one iteration over the array of page counters. The obvious disadvantage is the allocation of the array of the counters, but even in the worst case we support (4T allocator space, 64 buckets, 16 bytes bucket size, full free list, which leads to 2 bytes per page counter and ~17M page counters), requires just about 34Mb of the intermediate buffer (comparing to ~64Gb of actually allocated chunks) and usually it stays under 100K and released after each use. It is expected to be a relatively rare event, releasing memory back to OS, keeping the buffer between those runs and added complexity of the bookkeeping seems unnesessary here (it can always be improved later, though, never say never). The most interesting problem here is how to calculate the number of chunks falling into each memory page in the bucket. Skipping all the details, there are three cases when the number of chunks per page is constant: 1) P >= C, P % C == 0 --> N = P / C 2) C > P , C % P == 0 --> N = 1 3) C <= P, P % C != 0 && C % (P % C) == 0 --> N = P / C + 1 where P is page size, C is chunk size and N is the number of chunks per page and the rest of the cases, where the number of chunks per page is calculated on the go, during the page counter array iteration. Among the rest, there are still cases where N can be deduced from the page index, but they require not that much less calculations per page than the current "brute force" way and 2/3 of the buckets fall into the first three categories anyway, so, for the sake of simplicity, it was decided to stick to those two variations. It can always be refined and improved later, should we see that brute force way slows us down unacceptably. Reviewers: eugenis, cryptoad, dvyukov Subscribers: kubamracek, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D38245 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314311 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[builtins] fix build error on non-ARM for r314285.Manoj Gupta
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314289 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[Builtins] ARM: Fix assembling files in thumb mode.Manoj Gupta
Summary: clang does not assemble files in thumb mode unless .thumb declaration is present. Add .thumb/.arm decl to _FUNCTION macros to ensure that files are assembled correctly. Fixes PR 34715. Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin Reviewed By: compnerd Subscribers: aemerson, javed.absar, llvm-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D38227 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314285 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27[Builtins] ARM: Fix msr assembly instruction use for Thumb2.Manoj Gupta
Summary: MSR instruction in Thumb2 does not support immediate operand. Fix this by moving the condition for V7-M to Thumb2 since V7-M support Thumb2 only. With this change, aeabi_cfcmp.s and aeabi_cdcmp.S files can be assembled in Thumb2 mode. (This is split out from the review D38227). Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin, kristof.beyls Reviewed By: compnerd Subscribers: aemerson, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D38268 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314284 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26[Builtins] Use 4 byte alignment for __aeabi_memclr.Manoj Gupta
Summary: Align __aeabi_memclr to 4 bytes. All other ARM functions are already aligned to 4-bytes in compiler-rt. (Split off from review D38227) Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin, kristof.beyls Reviewed By: compnerd Subscribers: aemerson, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D38271 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314255 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26[scudo] Scudo thread specific data refactor, part 3Kostya Kortchinsky
Summary: Previous parts: D38139, D38183. In this part of the refactor, we abstract the Linux vs Android TSD dissociation in favor of a Exclusive vs Shared one, allowing for easier platform introduction and configuration. Most of this change consist of shuffling the files around to reflect the new organization. We introduce `scudo_platform.h` where platform specific definition lie. This involves the TSD model and the platform specific allocator parameters. In an upcoming CL, those will be configurable via defines, but we currently stick with conservative defaults. Reviewers: alekseyshl, dvyukov Reviewed By: alekseyshl, dvyukov Subscribers: srhines, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D38244 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314224 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26Invalidate symbolizer module list from dlopen/dlclose interceptorsFrancis Ricci
Summary: The module list should only be invalidated by dlopen and dlclose, so the symbolizer should only re-generate it when we've hit one of those functions. Reviewers: kubamracek, rnk, vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37268 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314219 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-25Add missing include to sanitizer procmapsFrancis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314162 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-25Fix style in sanitizer_procmaps.hFrancis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314157 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-25[sanitizer_common] Don't provide sanitizer_procmaps API functions where not ↵Francis Ricci
defined Summary: Platforms that don't implement procmaps (primarily fuchsia and windows) still expose the procmaps API when including sanitizer_procmaps.h, despite not implementing the functions provided by that header. Ensure that the API is only exposed on platforms that implement it. Reviewers: vitalybuka, alekseyshl, kubamracek Subscribers: llvm-commits, krytarowski Differential Revision: https://reviews.llvm.org/D38187 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314149 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-25[scudo] Scudo thread specific data refactor, part 2Kostya Kortchinsky
Summary: Following D38139, we now consolidate the TSD definition, merging the shared TSD definition with the exclusive TSD definition. We introduce a boolean set at initializaton denoting the need for the TSD to be unlocked or not. This adds some unused members to the exclusive TSD, but increases consistency and reduces the definitions fragmentation. We remove the fallback mechanism from `scudo_allocator.cpp` and add a fallback TSD in the non-shared version. Since the shared version doesn't require one, this makes overall more sense. There are a couple of additional cosmetic changes: removing the header guards from the remaining `.inc` files, added error string to a `CHECK`. Question to reviewers: I thought about friending `getTSDAndLock` in `ScudoTSD` so that the `FallbackTSD` could `Mutex.Lock()` directly instead of `lock()` which involved zeroing out the `Precedence`, which is unused otherwise. Is it worth doing? Reviewers: alekseyshl, dvyukov, kcc Reviewed By: dvyukov Subscribers: srhines, llvm-commits Differential Revision: https://reviews.llvm.org/D38183 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-23[ubsan] Replace CommonSanitizerReportMutex with ScopedErrorReportLockVitaly Buka
Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D38194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314053 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-23[ubsan] Support signal specific options in ubsanVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Standalone ubsan needs signal and sigaction handlers and interceptors. Plugin mode should rely on parent tool. Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D37895 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314052 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[lsan] Add __lsan_default_optionsVitaly Buka
For consistency with asan, msan, tsan and ubsan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314048 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[lsan] Deadly signal handler for lsanVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, dberris, kubamracek, krytarowski Differential Revision: https://reviews.llvm.org/D37608 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314041 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[sanitizer] Replace thread id with GetThreadSelfVitaly Buka
This allows to avoid constructor parameter git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314040 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[sanitizer] Move ScopedErrorReportLock into libcdep versionVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314039 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22Fix fuchsia builds broken by r313999Francis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314021 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[sanitizer] Replace AddressSanitizer with correct tool nameVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314015 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[sanitizer] Move report locking code from asan into commonVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314008 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[asan] Fix unlocking order for CommonSanitizerReportMutex and ↵Vitaly Buka
reporting_thread_tid_ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314007 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[sanitizer] Move CommonSanitizerReportMutex from _print.cc to _common.ccVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314006 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22Fix windows buildbot broken by r313999Francis Ricci
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314001 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22Removed platform-specific ifdefs from sanitizer_procmaps.hFrancis Ricci
Summary: Removed platform-specific ifdefs for linux, mac, freebsd and netbsd from sanitizer_procmaps.h Patch by Yicheng Wang <yichengfb@fb.com> Reviewers: kcc, kubamracek, alekseyshl, fjricci, vitalybuka Reviewed By: fjricci, vitalybuka Subscribers: vitalybuka, emaste, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D38098 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313999 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[scudo] Scudo thread specific data refactor, part 1Kostya Kortchinsky
Summary: We are going through an overhaul of Scudo's TSD, to allow for new platforms to be integrated more easily, and make the code more sound. This first part is mostly renaming, preferring some shorter names, correcting some comments. I removed `getPrng` and `getAllocatorCache` to directly access the members, there was not really any benefit to them (and it was suggested by Dmitry in D37590). The only functional change is in `scudo_tls_android.cpp`: we enforce bounds to the `NumberOfTSDs` and most of the logic in `getTSDAndLockSlow` is skipped if we only have 1 TSD. Reviewers: alekseyshl, dvyukov, kcc Reviewed By: dvyukov Subscribers: llvm-commits, srhines Differential Revision: https://reviews.llvm.org/D38139 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313987 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[asan/lsan] Make LSan compliant with recovery mode when running on top of ASanMaxim Ostapenko
Don't overwrite exit code in LSan when running on top of ASan in recovery mode to avoid breakage of users code due to found leaks. Patch by Slava Barinov. Differential Revision: https://reviews.llvm.org/D38026 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313966 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[tsan] Annotate function parameters with attribute 'noescape'.Akira Hatanaka
This commit annotates the block parameters of the following functions declared in compiler-rt with 'noescape': - dispatch_sync - dispatch_barrier_sync - dispatch_once - dispatch_apply This is needed to commit the patch that adds support for 'noescape' in clang (see https://reviews.llvm.org/D32210) since these functions are annotated with 'noescape' in the SDK header files. Differential Revision: https://reviews.llvm.org/D32210 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313929 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[XRay][compiler-rt] Remove non-trivial globals from xray_log_interface.ccDean Michael Berris
Summary: Remove dependency on std::unique_ptr<...> for the global representing the installed XRay implementation. Reviewers: dblaikie, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38121 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313871 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[ubsan] Split ubsan_init_standaloneVitaly Buka
Summary: On Linux we may need preinit_array in static lib and ubsan_standalone_initializer in shared lib. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D38013 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313851 91177308-0d34-0410-b5e6-96231b3b80d8