summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [LibFuzzer] Try to unbreak the `FuzzerMutate.ShuffleBytes1` unit test.Dan Liew2018-04-201-1/+1
| | | | | | | | | | | | | | This test is failing on my Linux box. Just increasing the number of iterations works around this. The divergence is likely due to our reliance on `std::shuffle()` which is not guaranteed to have the same behaviour across platforms. This is a strong argument for us to implement our own shuffle function to avoid divergence in behaviour across platforms. Differential Revision: https://reviews.llvm.org/D45767 llvm-svn: 330390
* [LibFuzzer] Unbreak the `trace-malloc-unbalanced.test` when using Python 3.Dan Liew2018-04-201-5/+5
| | | | | | | | | The `unbalanced_allocs.py` script uses Python 2 print statement and `iteritems()`. Running `2to3` over the script fixes these. Differential Revision: https://reviews.llvm.org/D45765 llvm-svn: 330389
* [Fuzzer] Add a missing header in Fuchsia implementationPetr Hosek2018-04-201-0/+1
| | | | | | | | This is needed for fd_set. Differential Revision: https://reviews.llvm.org/D45852 llvm-svn: 330383
* [sanitizer] Generalize atomic_uint8_t, atomic_uint16_t, ... into a template. ↵Kuba Mracek2018-04-191-28/+10
| | | | | | | | NFC. Differential Revision: https://reviews.llvm.org/D44246 llvm-svn: 330376
* [sanitizer] Minor refactor of some ReservedAddressRange functionsKostya Kortchinsky2018-04-193-37/+20
| | | | | | | | | | | | | | | | | | | Summary: Some of the functions had spurious conditional statements and checks, and some intermediary variables that I feel made the code more complicated than it needs to be. Also, when unmapping the whole range, the range size would be 0, but the base was set to the address of the end of the range, which sounds prone to error. I think nulling out the base in this scenario is a better way to go. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45775 llvm-svn: 330355
* [Fuzzer] Make InterruptHandler non-blocking for FuchsiaPetr Hosek2018-04-191-1/+6
| | | | | | | | | | | | | The initial naive approach to simulate SIGINT on Fuchsia was to getchar and look for ETX. This caused the InterruptHandler thread to lock stdin, preventing musl's exit() from being able to close the stdio descriptors and complete. This change uses select() instead. Patch By: aarongreen Differential Revision: https://reviews.llvm.org/D45636 llvm-svn: 330328
* tsan: fix compiler warningsDmitry Vyukov2018-04-191-3/+3
| | | | | | vmaSize is uptr, so we need to print it with %zd. llvm-svn: 330312
* [HWASan] Add "N" suffix to generic __hwasan_load/store.Alex Shlyapnikov2018-04-182-8/+8
| | | | | | | | | | | | | | | Summary: "N" suffix is added by the instrumentation and interface functions are expected to be exported from the library as __hwasan_loadN* and __hwasan_storeN*. Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45739 llvm-svn: 330297
* [sanitizer] Minor refactor of ThreadDescriptorSizeKostya Kortchinsky2018-04-181-14/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: While I was sifting through dead code findings, I stumbled on this function. First, for `__s390__` it always returned 0 for the 1st call, which doesn't seem right. 2nd call & beyond would return the correct value though. Then it duplicated the `atomic_store` multiple times, sometimes with a `if`, sometimes without. Finally it used a capitalized variable name starting with `k` which indicates a constant, and it is not. So: - rename the static global variable; - change the atomic functions to their relaxed version; - move the store to the end, and make sure we return `val` all the time. Reviewers: alekseyshl, eugenis, koriakin Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45725 llvm-svn: 330268
* [XRay][compiler-rt] Add noop patch functions for unsupported arches.Keith Wyss2018-04-175-0/+30
| | | | | | | | | | | | | | Summary: Typed event patching is implemented for x86-64, but functions must be defined for other arches. Reviewers: dberris, pelikan Subscribers: nemanjai, javed.absar, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45749 llvm-svn: 330231
* Implement trampoline and handler for typed xray event tracing.Keith Wyss2018-04-178-11/+195
| | | | | | | | | | | | | | Summary: Compiler-rt support first before defining the __xray_typedevent() lowering in llvm. I'm looking for some early feedback before I touch much more code. Reviewers: dberris Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43668 llvm-svn: 330218
* [sanitizer] Remove low-hanging-fruit dead codeKostya Kortchinsky2018-04-175-48/+0
| | | | | | | | | | | | | | | | | Summary: Going through the dead code findings, the code removed in this CL appears to be pretty straightforward to remove, and seems to be some leftover from previous refactors. Reviewers: alekseyshl, eugenis Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45704 llvm-svn: 330190
* [sanitizer] Fix OSX build failure post D45457Kostya Kortchinsky2018-04-162-1/+7
| | | | | | | | | | | | Summary: It looks like OSX's UBSan needs a "NoHooks" version of `RTSanitizerCommonSymbolizer` to work build properly. Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45696 llvm-svn: 330146
* [sanitizer] Build failures fixes post D45457Kostya Kortchinsky2018-04-163-0/+3
| | | | | | | | | | Summary: Adding a couple missed RTSanitizerCommonSymbolizer in makefiles. Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45694 llvm-svn: 330134
* [sanitizer] Split Symbolizer/StackTraces from core RTSanitizerCommonKostya Kortchinsky2018-04-1623-336/+386
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Host symbolizer & stacktraces related code in their own RT: `RTSanitizerCommonSymbolizer`, which is "libcdep" by nature. Symbolizer & stacktraces specific code that used to live in common files is moved to a new file `sanitizer_symbolizer_report.cc` as is. The purpose of this is the enforce a separation between code that relies on symbolization and code that doesn't. This saves the inclusion of spurious code due to the interface functions with default visibility, and the extra data associated. The following sanitizers makefiles were modified & tested locally: - dfsan: doesn't require the new symbolizer RT - esan: requires it - hwasan: requires it - lsan: requires it - msan: requires it - safestack: doesn't require it - xray: doesn't require it - tsan: requires it - ubsan: requires it - ubsan_minimal: doesn't require it - scudo: requires it (but not for Fuchsia that has a minimal runtime) This was tested locally on Linux, Android, Fuchsia. Reviewers: alekseyshl, eugenis, dberris, kubamracek, vitalybuka, dvyukov, mcgrathr Reviewed By: alekseyshl, vitalybuka Subscribers: srhines, kubamracek, mgorny, krytarowski, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45457 llvm-svn: 330131
* tsan: add support for linux/powerpc64 in buildgo.shDmitry Vyukov2018-04-164-6/+106
| | | | | | | | | | | The current implementation of the Go sanitizer only works on x86_64. Added some modifications to the buildgo.sh script and the Tsan code to make it work on powerpc64/linux. Author: cseo (Carlos Eduardo Seo) Reviewed in: https://reviews.llvm.org/D43025 llvm-svn: 330122
* [Fuzzer] Avoid C++ compiler checks for fuzzer C++ libraryPetr Hosek2018-04-131-1/+2
| | | | | | | | | | | When bulding libFuzzer as part of the toolchain, C++ library may not have been fully built yet so the C++ compiler checks will fail, but we don't care since we don't need C++ library anyway as we're building our own. Differential Revision: https://reviews.llvm.org/D45638 llvm-svn: 330075
* [sanitizer] Allow for the allocator "names" to be set by the toolsKostya Kortchinsky2018-04-137-9/+20
| | | | | | | | | | | | | | | | | | | Summary: In the same spirit of SanitizerToolName, allow the Primary & Secondary allocators to have names that can be set by the tools via PrimaryAllocatorName and SecondaryAllocatorName. Additionally, set a non-default name for Scudo. Reviewers: alekseyshl, vitalybuka Reviewed By: alekseyshl, vitalybuka Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45600 llvm-svn: 330055
* [sanitizer] Fix __sanitizer::Vector::Resize vectorVitaly Buka2018-04-132-0/+13
| | | | | | | | | | | | | | | | Implemented downsizing Patch by Oleg Doronin Reviewers: kcc, vitalybuka Reviewed By: kcc, vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45605 llvm-svn: 330049
* [sanitizer] Replace cast with unsigned literals in testsVitaly Buka2018-04-131-4/+4
| | | | llvm-svn: 330048
* [XRay] [compiler-rt] reformat and clarify CMakeLists.txt [NFC]Martin Pelikan2018-04-131-55/+36
| | | | | | | | | | | | | | | | | | Summary: - last change (+ the Apple support change) missed a lot of indentation - shorten architecture SOURCES definitions as most fit 1 line/arch - comment in English what's where, and where the different .a come from (using only the word "runtime" in the comment isn't useful, since the CMake primitive itself says "runtime" in its name) - skip unsupported architectures quickly, to avoid extra indentation Reviewers: dberris, eizan, kpw Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45568 llvm-svn: 329998
* [tsan] Add interceptors for objc_sync_enter and objc_sync_exitKuba Mracek2018-04-132-1/+14
| | | | | | | | Objective-C's @synchronize synchronization primitive uses calls to objc_sync_enter and objc_sync_exit runtime functions. In most cases, they end up just calling pthread_mutex_lock/pthread_mutex_unlock, but there are some cases where the synchronization from pthread_mutex_lock/pthread_mutex_unlock interceptors isn't enough. Let's add explicit interceptors for objc_sync_enter and objc_sync_exit to handle all cases. Differential Revision: https://reviews.llvm.org/D45487 llvm-svn: 329982
* [asan] Reduce flakiness in stack-overflow detectionKuba Mracek2018-04-131-1/+3
| | | | | | | | IsStackOverflow only treats accesses within 512 bytes of SP as stack-overflow. This should really be the size of a page instead. The scariness_score_test.cc triggers stack overflow with frames that are even larger than a page, which can also trigger a fault that will not be recognized as stack-overflow. Let's just use smaller frames. llvm-svn: 329980
* [asan] Remove malloc_context_size=0 from asan_device_setup.Evgeniy Stepanov2018-04-121-1/+1
| | | | | | | | This line was added in r243679 - [asan] Support arm64 devices in asan_device_setup without any good reason. llvm-svn: 329962
* [scudo] Remove duplicate cmake flagsKostya Kortchinsky2018-04-121-1/+1
| | | | | | | | | | | | | | | | Summary: Now that common options are propagated again for runtimes build with D45507, the -f{data,function}-sections flags are now duplicates, remove them. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45575 llvm-svn: 329925
* [sanitizer] Correct name length computation for some Fuchsia vmosKostya Kortchinsky2018-04-111-1/+1
| | | | | | | | | | | | | | | | | Summary: This was missed during the review of D38595, but the vmo name size computation should use internal_strlen, not sizeof, otherwise we end up with 7 character names. Reviewers: mcgrathr, flowerhack Reviewed By: mcgrathr Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45525 llvm-svn: 329842
* [xray] Fix OS X bots.George Karpenkov2018-04-111-15/+15
| | | | | | OS X has "fat" executables which contain the code for all architectures. llvm-svn: 329832
* [XRay][compiler-rt] Fix osx-based buildsDean Michael Berris2018-04-111-11/+22
| | | | | | This is a follow-up to D45474. llvm-svn: 329776
* [XRay][clang+compiler-rt] Support build-time mode selectionDean Michael Berris2018-04-112-11/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch implements the `-fxray-modes=` flag which allows users building with XRay instrumentation to decide which modes to pre-package into the binary being linked. The default is the status quo, which will link all the available modes. For this to work we're also breaking apart the mode implementations (xray-fdr and xray-basic) from the main xray runtime. This gives more granular control of which modes are pre-packaged, and picked from clang's invocation. This fixes llvm.org/PR37066. Note that in the future, we may change the default for clang to only contain the profiling implementation under development in D44620, when that implementation is ready. Reviewers: echristo, eizan, chandlerc Reviewed By: echristo Subscribers: mgorny, mgrang, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D45474 llvm-svn: 329772
* [sanitizer] Allow BackgroundThread to not depend on StackDepot v2Kostya Kortchinsky2018-04-101-12/+18
| | | | | | | | | | | | | | | | | | | | Summary: This is a redo of D45296. It looks like the random stack-protector issues I was getting were coming from my Android emulator, and updating everything all around and relaunching stuff ended up making it go away. I guess I'll have to see how it behaves on the bots. Only additional change from the previous CL is some `const` were appropriate. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45461 llvm-svn: 329706
* [sanitizer] Enable threads for libc++ build used by the symbolizerPetr Hosek2018-04-102-2/+4
| | | | | | | | | Disabling threads makes <atomic> unusable, but this is needed by LLVM libraries that are dependencies of the symbolizer. Differential Revision: https://reviews.llvm.org/D45424 llvm-svn: 329672
* GetRandom / OpenBSD, using getentropy to get high quality randomnessVitaly Buka2018-04-091-1/+19
| | | | | | | | | | | | | | | | | | | Summary: - getentropy presence since late 2014, safe to use. - guarantees to delivers good random data up to 256 bytes. - fall back to /dev/urandom as long the buffer is correct. Patch by David CARLIER Reviewers: kubamracek, vitalybuka Reviewed By: vitalybuka Subscribers: cryptoad, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44866 llvm-svn: 329633
* libFuzzer, OpenBSD supportVitaly Buka2018-04-096-8/+39
| | | | | | | | | | | | | | | | | | Summary: - Enabling libfuzzer on OpenBSD - OpenBSD can t support asan, msan ... the tests can t be run. Patch by David CARLIER Reviewers: eugenis, phosek, vitalybuka Reviewed By: vitalybuka Subscribers: srhines, mgorny, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44877 llvm-svn: 329631
* [sanitizer] Reverting rCRT329595Kostya Kortchinsky2018-04-091-14/+10
| | | | | | | | | | | | Summary: Even this version seems to mess with Android somehow. Reverting for now while I figure out what's up. Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45450 llvm-svn: 329606
* [sanitizer] Allow BackgroundThread to not depend on StackDepotKostya Kortchinsky2018-04-091-10/+14
| | | | | | | | | | | | | | | | | | | | Summary: Still pursuing the ultimate goal of splitting the Symbolizer code from RTSanitizerCommon core, allow `BackgroundThread` to work even when not linked with `sanitizer_stackdepot.cc`. There is no reason this function should pull in the whole `StackDepot` if symbolization is not supported. Currently this has no functional change as the depot is always linked anyway. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45296 llvm-svn: 329595
* [ASan] NFC: make use of a new ErrorBase ctorAlex Shlyapnikov2018-04-091-117/+71
| | | | | | | | | | | | | | | Summary: Minor style changes to complement D44404: - make use of a new ErrorBase ctor - de-duplicate a comment about VS2013 support Reviewers: eugenis Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45390 llvm-svn: 329586
* [libFuzzer] Print a correct error message when a directory can't beMatt Morehouse2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | opened. Summary: Currently if the directory cannot be opened for a reason other than non-existence (e.g. too many open file descriptors) the error message printed is incredibly confusing. Patch By: Alex Gaynor Reviewers: kcc, morehouse Reviewed By: morehouse Subscribers: delcypher, llvm-commits, Sanitizers Differential Revision: https://reviews.llvm.org/D45322 llvm-svn: 329438
* [sanitizer] Split stacktrace/symbolizer: Windows unwindKostya Kortchinsky2018-04-043-52/+77
| | | | | | | | | | | | | | | | | | | Summary: The purpose of this set of changes is to separate stackframe/symbolizer support into their own RT within sanitizer_common. Sanitizers with no use for those could then be built without the extraneous dependencies pulled in by the default visibility interface functions. I am aiming to do small changes for specific platforms. In this one, we split the unwind functions from sanitizer_win.cc into their own sanitizer_unwind_win.cc. Reviewers: alekseyshl, rnk Reviewed By: alekseyshl, rnk Subscribers: delcypher, #sanitizers, kubamracek, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D44799 llvm-svn: 329204
* [XRay][compiler-rt] Build XRay runtime for OpenBSDDean Michael Berris2018-04-041-2/+11
| | | | | | | | | | | | | | | | | | Summary: This is D45125; the patch enables the build of XRay on OpenBSD. We also introduce some OpenBSD specific changes to the runtime implementation, involving how we get the TSC rate through the syscall interface specific to OpenBSD. Reviewers: dberris Authored by: devnexen Subscribers: dberris, mgorny, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D45125 llvm-svn: 329189
* [sanitizer] Remove empty Symbolizer PrepareForSandboxingKostya Kortchinsky2018-04-0310-38/+10
| | | | | | | | | | | | | | | | | | | | | | | Summary: `Symbolizer::PrepareForSandboxing` is empty for all platforms and apparently has been for a while (D10213). Remove it, and shuffle things around so that the platform specific code is now in `PlatformPrepareForSandboxing`. This allows to have one less symbolizer dependency in a common file, which helps for the upcoming split. Also remove `SymbolizerPrepareForSandboxing` in tsan_go which appears to not be used anywhere. Reviewers: alekseyshl, eugenis, dvyukov, mcgrathr Reviewed By: alekseyshl Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44953 llvm-svn: 329094
* [profile] Fix value profile runtime merging issuesRong Xu2018-04-026-18/+45
| | | | | | | | | | | | | | | | This patch fixes the following issues: (1) The strong definition of the merge hook function was not working which breaks the online value profile merging. This patch removes the weak attribute of VPMergeHook and assigns the value dynamically. (2) Truncate the proifle file so that we don't have garbage data at the end of the file. (3) Add new __llvm_profile_instrument_target_value() interface to do the value profile update in batch. This is needed as the original incremental by 1 in __llvm_profile_instrument_target() is too slow for online merge. Differential Revision: https://reviews.llvm.org/D44847 llvm-svn: 328987
* [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-03-288-31/+340
| | | | | | | | | | | | | | | | | | Summary: Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, not stack, no details, not too helpful nor informative. To improve the situation, ASan detailed errors were defined and reported under the appropriate conditions. Issue: https://github.com/google/sanitizers/issues/887 Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328722
* [asan] Add vfork to the list of reasons for stack errors.Evgeniy Stepanov2018-03-281-1/+1
| | | | | | | Until we figure out what to do with it, vfork can cause stack-based false positives. llvm-svn: 328681
* [scudo] Fuchsia minimal shared runtimeKostya Kortchinsky2018-03-271-21/+24
| | | | | | | | | | | | | | | | | | | Summary: Fuchsia requires its Scudo shared runtime to not be C++ dependant. Since they don't use UBSan in conjunction with Scudo, we can just remove the runtime, and add the extra `nostdinc++` and `nostdlib++` flags. No need for Coverage either. This allows to keep things going while working on additional splits of sanitizer_commong and a more minimal runtime. Reviewers: phosek, flowerhack, alekseyshl Reviewed By: phosek, alekseyshl Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44791 llvm-svn: 328625
* Revert "[asan] Replace vfork with fork."Evgeniy Stepanov2018-03-272-13/+0
| | | | | | | | | Replacing vfork with fork results in significant slowdown of certain apps (in particular, memcached). This reverts r327752. llvm-svn: 328600
* [sanitizer] Fix Darwin buildVitaly Buka2018-03-242-3/+7
| | | | llvm-svn: 328417
* Mmap interceptor providing mprotect supportVitaly Buka2018-03-246-31/+53
| | | | | | | | | | | | | | | | Summary: - Intercepting mprotect calls. - Fixing forgotten flag check. Patch by David CARLIER Reviewers: vitalybuka, vsk Subscribers: delcypher, srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44777 llvm-svn: 328415
* [sanitizer] Fix strlcpy and strlcat interceptors on DarwinVitaly Buka2018-03-241-3/+3
| | | | llvm-svn: 328414
* Remove duplicated const qualifier.Alex Shlyapnikov2018-03-241-1/+1
| | | | llvm-svn: 328403
* [HWASan] Port HWASan to Linux x86-64 (compiler-rt)Alex Shlyapnikov2018-03-235-42/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Porting HWASan to Linux x86-64, first of the three patches, compiler-rt part. The approach is similar to ARM case, trap signal is used to communicate memory tag check failure. int3 instruction is used to generate a signal, access parameters are stored in nop [eax + offset] instruction immediately following the int3 one Had to add HWASan init on malloc because, due to much less interceptors defined (most other sanitizers intercept much more and get initalized via one of those interceptors or don't care about malloc), HWASan was not initialized yet when libstdc++ was trying to allocate memory for its own fixed-size heap, which led to CHECK-fail in AllocateFromLocalPool. Also added the CHECK() failure handler with more detailed message and stack reporting. Reviewers: eugenis Subscribers: kubamracek, dberris, mgorny, kristof.beyls, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44705 llvm-svn: 328385
OpenPOWER on IntegriCloud