summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [lsan] Respect log_path option in standalone LSanMaxim Ostapenko2018-01-221-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D42303 llvm-svn: 323083
* [NFC] fix trivial typos in commentsHiroshi Inoue2018-01-221-1/+1
| | | | | | "the the" -> "the" llvm-svn: 323080
* Reland "[Fuzzer] Parametrize add_custom_libcxx"Petr Hosek2018-01-214-15/+17
| | | | | | | | | | | | | add_custom_libcxx uses the just built compiler and installs the built libc++, e.g. for testing, neither of which is desirable in case of Fuzzer where the libc++ should be built using the host compiler and it's only linked into the libFuzzer and should never be installed. This change introduces additional arguments to add_custom_libcxx to allow parametrizing its behavior. Differential Revision: https://reviews.llvm.org/D42330 llvm-svn: 323054
* [compiler-rt] Implement __clear_cache() on OpenBSD/mips64Kamil Rytarowski2018-01-201-0/+7
| | | | | | | | | | | | | | | | Summary: Make __clear_cache() invoke the platform's cache flush function on OpenBSD/mips64. Reviewers: krytarowski Reviewed By: krytarowski Subscribers: sdardis, dberris, arichardson, krytarowski, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42332 llvm-svn: 323039
* Revert "[Fuzzer] Parametrize add_custom_libcxx"Petr Hosek2018-01-204-12/+9
| | | | | | This reverts commit r323032: failing on the sanitizer-x86_64-linux-autoconf bot. llvm-svn: 323033
* [Fuzzer] Parametrize add_custom_libcxxPetr Hosek2018-01-204-9/+12
| | | | | | | | | | | | | add_custom_libcxx uses the just built compiler and installs the built libc++, e.g. for testing, neither of which is desirable in case of Fuzzer where the libc++ should be built using the host compiler and it's only linked into the libFuzzer and should never be installed. This change introduces additional arguments to add_custom_libcxx to allow parametrizing its behavior. Differential Revision: https://reviews.llvm.org/D42330 llvm-svn: 323032
* Reland "Fix syntax error introduced in r322991"Petr Hosek2018-01-201-2/+2
| | | | | | | | This triggers compiler error when building sanitizers for Fuchsia. Differential Revision: https://reviews.llvm.org/D42328 llvm-svn: 323029
* Revert "[sanitizer] Fix syntax error introduced in r322991"Petr Hosek2018-01-201-2/+2
| | | | | | This reverts commit r323027: it breaks the SanitizerLintCheck. llvm-svn: 323028
* [sanitizer] Fix syntax error introduced in r322991Petr Hosek2018-01-201-2/+2
| | | | | | | | This triggers compiler error when building sanitizers for Fuchsia. Differential Revision: https://reviews.llvm.org/D42328 llvm-svn: 323027
* Support the localtime interceptor for NetBSDKamil Rytarowski2018-01-201-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: The localtime symbol is mangled to __locatime50 on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42045 llvm-svn: 323019
* Intercept accept4() on NetBSDKamil Rytarowski2018-01-201-1/+1
| | | | | | | | | | | | | | | | | | | Summary: The accept4() function first appeared in NetBSD 8.0. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, srhines, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42046 llvm-svn: 323018
* [TSan][MIPS] Expand sanitizer memory space to lower addressesPetar Jovanovic2018-01-201-13/+15
| | | | | | | | | | | | | | | | | | | | MemToShadowImpl() maps lower addresses to a memory space out of sanitizers range. The simplest example is address 0 which is mapped to 0x2000000000 static const uptr kShadowBeg = 0x2400000000ull; but accessing the address during tsan execution will lead to a segmentation fault. This patch expands the range used by the sanitizer and ensures that 1/8 of the maximum valid address in the virtual address spaces is used for shadow memory. Patch by Milos Stojanovic. Differential Revision: https://reviews.llvm.org/D41777 llvm-svn: 323013
* [sanitizer] Allow Fuchsia to use getauxvalKostya Kortchinsky2018-01-191-3/+4
| | | | | | | | | | | | | | | | | Summary: Fuchsia has `getauxval` (https://fuchsia.googlesource.com/zircon/+/master/third_party/ulib/musl/include/sys/auxv.h, https://fuchsia.googlesource.com/zircon/+/master/third_party/ulib/musl/src/misc/getauxval.c) so set SANITIZER_USE_GETAUXVAL to 1 for this platform. Reviewers: alekseyshl, flowerhack Reviewed By: flowerhack Subscribers: srhines, kubamracek, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42315 llvm-svn: 323002
* [scudo] Pass SANITIZER_COMMON_LINK_FLAGS to the shared library LINK_FLAGSKostya Kortchinsky2018-01-191-0/+3
| | | | | | | | | | | | | | | | | | Summary: We somehow never did it, and it raised no issue until now, when trying to enable Fuchsia as a supported Scudo platform in the cmake config. So propagate SANITIZER_COMMON_LINK_FLAGS for now. Reviewers: alekseyshl, flowerhack Reviewed By: flowerhack Subscribers: mgorny, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42314 llvm-svn: 322999
* Reland "Make TracePcGuardController linker-initialized"Petr Hosek2018-01-191-6/+6
| | | | | | | | | | It was always intended to be. Patch By: mcgrathr Differential Revision: https://reviews.llvm.org/D41513 llvm-svn: 322991
* Correct typo after r322829Kamil Rytarowski2018-01-191-2/+2
| | | | llvm-svn: 322947
* [XRay] [compiler-rt] fix heap overflow by computing record pointers correctlyMartin Pelikan2018-01-191-22/+15
| | | | | | | | | | | | | | | | | | Summary: While there, unify InMemoryRawLog and InMemoryRawLogWithArg's coding style: - swap libc's memcpy(3) for sanitizer's internal memcpy - use basic pointer arithmetics to compute offsets from the first record entry in the pre-allocated buffer, which is always the appropriate type for the given function - lose the local variable references as the TLD.* names fit just as well Reviewers: eizan, kpw, dberris, dblaikie Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42289 llvm-svn: 322941
* [builtins] Use FlushInstructionCache on windows on aarch64 as wellMartin Storsjo2018-01-191-2/+2
| | | | | | | | | | Generalize this handling to a separate toplevel ifdef (since any windows case should use the same function), instead of indenting the aarch64 case one step further. Differential Revision: https://reviews.llvm.org/D42197 llvm-svn: 322928
* Break a line into two linesKamil Rytarowski2018-01-181-1/+2
| | | | | | This should restore the rule of <=80 characters per line. llvm-svn: 322841
* Add new NetBSD interceptors: getgrouplist(3) & getgroupmembership(3)Kamil Rytarowski2018-01-182-0/+42
| | | | | | | | | | | | | | | | | | | Summary: getgrouplist, getgroupmembership -- calculate group access list Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42064 llvm-svn: 322836
* Add new interceptors: access(2), faccessat(2)Kamil Rytarowski2018-01-182-0/+30
| | | | | | | | | | | | | | | | | | | Summary: access, faccessat - check access permissions of a file or pathname Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42065 llvm-svn: 322831
* Add new interceptors for pwcache(3)-style functionsKamil Rytarowski2018-01-182-0/+72
| | | | | | | | | | | | | | | | | | | | | Summary: From <pwd.h>: user_from_uid, uid_from_user From <grp.h>: group_from_gid, gid_from_group Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42068 llvm-svn: 322829
* [Sanitizers] Changes in Hwasan allocator missed in D42198.Alex Shlyapnikov2018-01-181-5/+5
| | | | | | Converting a few failure handler calls missed in D42198. llvm-svn: 322793
* [Sanitizers] Make common allocator agnostic to failure handling modes.Alex Shlyapnikov2018-01-1710-57/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make common allocator agnostic to failure handling modes and move the decision up to the particular sanitizer's allocator, where the context is available (call stack, parameters, return nullptr/crash mode etc.) It simplifies the common allocator and allows the particular sanitizer's allocator to generate more specific and detailed error reports (which will be implemented later). The behavior is largely the same, except one case, the violation of the common allocator's check for "size + alignment" overflow is now reportied as OOM instead of "bad request". It feels like a worthy tradeoff and "size + alignment" is huge in this case anyway (thus, can be interpreted as not enough memory to satisfy the request). There's also a Report() statement added there. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42198 llvm-svn: 322784
* [scudo] Fix for the Scudo interface function scopeKostya Kortchinsky2018-01-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A forgotten include in `scudo_allocator.cpp` made the symbol only local :/ Before: ``` nm ./lib/clang/7.0.0/lib/linux/libclang_rt.scudo-i686-android.so | grep rss 00024730 t __scudo_set_rss_limit ``` After: ``` nm ./lib/clang/7.0.0/lib/linux/libclang_rt.scudo-i686-android.so | grep rs 00024760 T __scudo_set_rss_limit ``` And we want `T`! This include also means that we can get rid of the `extern "C"` in the C++ file, the compiler does fine without it (note that this was already the case for all the `__sanitizer_*` interface functions. Reviewers: alekseyshl, eugenis Reviewed By: eugenis Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42199 llvm-svn: 322782
* [scudo] Limit by default the TSD pool to 2 on AndroidKostya Kortchinsky2018-01-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: jemalloc on Android currently uses 2 arenas (https://android.googlesource.com/platform/external/jemalloc/+/master/Android.bp#64). Since the Android toolchain absorbs compiler-rt and compiles it as is, we have to enforce the same limit to somehow stay competitive in terms of memory usage. The changes could either go in: - `scudo_platform.h` with a default for Android of 2 (this is the solution implemented here); - in `CMakeLists.txt` adding -DSCUDO_SHARED_TSD_POOL_SIZE=2 for Android. - something else? I don't have a strong opinion on how to do it, but it has to be done upstream anyway. Reviewers: alekseyshl, eugenis Reviewed By: alekseyshl, eugenis Subscribers: srhines, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42194 llvm-svn: 322764
* Reland "[libFuzzer] Support using libc++"Petr Hosek2018-01-175-15/+67
| | | | | | | | | | | | This is needed in case the users of libFuzzer use libc++ in their code, which the fuzz target (libFuzzer) will be linked against. When libc++ source is available, we build a private version of it and link it against libFuzzer which allows using the same static library against codebases which use both libc++ and libstdc++. Differential Revision: https://reviews.llvm.org/D37631 llvm-svn: 322755
* Revert "[libFuzzer] Support using libc++"Petr Hosek2018-01-175-67/+15
| | | | | | This reverts commit r322604: test is failing for standalone compiler-rt. llvm-svn: 322689
* Add new interceptor: acct(2)Kamil Rytarowski2018-01-172-0/+16
| | | | | | | | | | | | | | | | | | | Summary: acct - enable or disable process accounting Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42066 llvm-svn: 322646
* [Sanitizers, test] Fix sanitizer tests on Solaris (PR 33274)Kamil Rytarowski2018-01-173-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch (on top of the previous two (https://reviews.llvm.org/D40898 and https://reviews.llvm.org/D40899) complete the compiler-rt side of the the Solaris sanitizer port. It contains the following sets of changes: * For the time being, the port is for 32-bit x86 only, so reject the various tests on x86_64. * When compiling as C++, <setjmp.h> resp. <iso/setjmp_iso.h> only declares _setjmp and _longjmp inside namespace std. * MAP_FILE is a Windows feature. While e.g. Linux <sys/mman.h> provides a no-op compat define, Solaris does not. * test/asan/TestCases/Posix/coverage.cc was initially failing like this: /vol/gcc/src/llvm/llvm/local/projects/compiler-rt/lib/sanitizer_common/scripts/sancov.py: 4 files merged; 2 PCs total rm: cannot remove '/var/gcc/llvm/local/projects/compiler-rt/test/asan/I386SunOSConfig/TestCases/Posix/Output/coverage': Invalid argument Further digging revealed that the rm was trying to remove the running test's working directory which failed as observed. cd'ing out of the dir before let the test pass. * Two tests needed a declaration of alloca. I've now copied the existing code from test/asan/TestCases/alloca_constant_size.cc, but it may be more profitable and maintainable to have a common testsuite header where such code is collected. * Similarly, Solaris' printf %p format doesn't include the leading 0x. * In test/asan/TestCases/malloc-no-intercept.c, I had to undef __EXTENSIONS__ (predefined by clang for no apparent reason) to avoid conflicting declarations for memalign. * test/ubsan/TestCases/Float/cast-overflow.cpp has different platform dependent ways to define BYTE_ORDER and friends. Why not just use __BYTE_ORDER__ and friends as predefined by clang and gcc? Patch by Rainer Orth. Reviewers: kcc, alekseyshl Reviewed By: alekseyshl Subscribers: srhines, kubamracek, mgorny, krytarowski, fedor.sergeev, JDevlieghere, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40900 llvm-svn: 322635
* cfi: Add a blacklist entry for MSVC's std::get_temporary_buffer function.Peter Collingbourne2018-01-171-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D42150 llvm-svn: 322607
* [libFuzzer] Support using libc++Petr Hosek2018-01-175-15/+67
| | | | | | | | | | | | This is needed in case the users of libFuzzer use libc++ in their code, which the fuzz target (libFuzzer) will be linked against. When libc++ source is available, we build a private version of it and link it against libFuzzer which allows using the same static library against codebases which use both libc++ and libstdc++. Differential Revision: https://reviews.llvm.org/D37631 llvm-svn: 322604
* [hwasan] Build runtime library with -fPIC, not -fPIE.Evgeniy Stepanov2018-01-161-1/+1
| | | | | | | | | | | | Summary: -fPIE can not be used when building a shared library. Reviewers: alekseyshl, peter.smith Subscribers: kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D42121 llvm-svn: 322588
* Reland "Install resource files into a share/ directory"Petr Hosek2018-01-141-2/+5
| | | | | | | | | | | Currently these files are being installed into a root installation directory, but this triggers an error when the installation directory is set to an empty string which is often the case when DESTDIR is used to control the installation destination. Differential Revision: https://reviews.llvm.org/D41673 llvm-svn: 322451
* [Sanitizers, LSan, Darwin] Allow for lack of VM_MEMORY_OS_ALLOC_ONCEFrancis Ricci2018-01-131-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Some time ago, the sanitizers as of r315899 were imported into gcc mainline. This broke bootstrap on Darwin 10 and 11, as reported in GCC PR sanitizer/82824 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82824) due to the unconditional use of VM_MEMORY_OS_ALLOC_ONCE. This was only introduced in Darwin 13/Mac OS X 10.9. The use of the macro was introduced in r300450. I couldn't find any statement which Darwin versions are supposed to be supported by LLVM, but the trivial patch to use the macro only if present allowed the gcc bootstrap to finish. So far, I haven't tried building llvm/compiler-rt on Darwin 11. Maybe the patch is simple enough to go in nonetheless. Committing on behalf of ro. Reviewers: glider, fjricci, kcc, kuba, kubamracek, george.karpenkov Reviewed By: fjricci Subscribers: #sanitizers, zaks.anna, srhines, dberris, kubamracek, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39888 llvm-svn: 322437
* [hwasan] An LLVM flag to disable stack tag randomization.Evgeniy Stepanov2018-01-132-0/+11
| | | | | | | | | | | | Summary: Necessary to achieve consistent test results. Reviewers: kcc, alekseyshl Subscribers: kubamracek, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D42023 llvm-svn: 322429
* Revert "[SanitizerCoverage][Fuchsia] Make TracePcGuardController ↵Petr Hosek2018-01-131-6/+6
| | | | | | | | linker-initialized" This reverts commit r322424: this broke the tsan lint check. llvm-svn: 322428
* [SanitizerCoverage][Fuchsia] Make TracePcGuardController linker-initializedPetr Hosek2018-01-131-6/+6
| | | | | | | | | | It was always intended to be. Patch By: mcgrathr Differential Revision: https://reviews.llvm.org/D41513 llvm-svn: 322424
* Switch from Bourne shell to simply base shell to build libfuzzerKamil Rytarowski2018-01-121-1/+1
| | | | | | | | | | | | | | Summary: It is not necessary launching the build script with bash. Reviewers: krytarowski Reviewed By: krytarowski Subscribers: llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42008 llvm-svn: 322422
* Correct the setitimer interceptor on NetBSDKamil Rytarowski2018-01-124-2/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: itimerval can contain padding that may be legitimately uninitialized. On NetBSD there are four integers of type "long, int, long, int", the int argument stands for __sanitizer_suseconds_t. Compiler adds extra padding in this layout. Check every field of struct itimerval separately. Define __sanitizer_suseconds_t as long on FreeBSD, Linux and SmartOS, and int on NetBSD. Define __sanitizer_timeval and __sanitizer_itimerval. Sponsored by <The NetBSD Foundation> Reviewers: eugenis, joerg, vitalybuka Reviewed By: vitalybuka Subscribers: emaste, kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D41502 llvm-svn: 322399
* [scudo] Add SANITIZER_CXX_ABI_LIBRARY to SCUDO_DYNAMIC_LIBSKostya Kortchinsky2018-01-121-1/+2
| | | | | | | | | | | | | | | | | | Summary: This is needed for the shared runtime since we are pulling RTUbsan in. Otherwise some builds might fail with errors such as: `error: undefined reference to '__dynamic_cast'` Reviewers: alekseyshl, srhines Reviewed By: srhines Subscribers: kongyi, pirama, chh, mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D41995 llvm-svn: 322389
* lib Fuzzer FreeBSD supportKamil Rytarowski2018-01-129-12/+32
| | | | | | | | | | | | | | Summary: Patch by David CARLIER Reviewers: vitalybuka, kcc, dim, emaste, davide, morehouse, george.karpenkov Reviewed By: morehouse Subscribers: george.karpenkov, kubamracek, srhines, mgorny, emaste, krytarowski Differential Revision: https://reviews.llvm.org/D41642 llvm-svn: 322380
* [hwasan] Stack instrumentation.Evgeniy Stepanov2018-01-115-8/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Very basic stack instrumentation using tagged pointers. Tag for N'th alloca in a function is built as XOR of: * base tag for the function, which is just some bits of SP (poor man's random) * small constant which is a function of N. Allocas are aligned to 16 bytes. On every ReturnInst allocas are re-tagged to catch use-after-return. This implementation has a bunch of issues that will be taken care of later: 1. lifetime intrinsics referring to tagged pointers are not recognized in SDAG. This effectively disables stack coloring. 2. Generated code is quite inefficient. There is one extra instruction at each memory access that adds the base tag to the untagged alloca address. It would be better to keep tagged SP in a callee-saved register and address allocas as an offset of that XOR retag, but that needs better coordination between hwasan instrumentation pass and prologue/epilogue insertion. 3. Lifetime instrinsics are ignored and use-after-scope is not implemented. This would be harder to do than in ASan, because we need to use a differently tagged pointer depending on which lifetime.start / lifetime.end the current instruction is dominated / post-dominated. Reviewers: kcc, alekseyshl Subscribers: srhines, kubamracek, javed.absar, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D41602 llvm-svn: 322324
* Revert "Install resource files into a share/ directory"Petr Hosek2018-01-111-2/+2
| | | | | | This reverts commit r322256: broke the dfsan build. llvm-svn: 322261
* Reland "Install resource files into a share/ directory"Petr Hosek2018-01-111-2/+2
| | | | | | | | | | | Currently these files are being installed into a root installation directory, but this triggers an error when the installation directory is set to an empty string which is often the case when DESTDIR is used to control the installation destination. Differential Revision: https://reviews.llvm.org/D41673 llvm-svn: 322256
* Revert "Install resource files into a share/ directory"Petr Hosek2018-01-111-1/+1
| | | | | | This reverts commit r322234: this is breaking dfsan tests. llvm-svn: 322243
* Reland "Install resource files into a share/ directory"Petr Hosek2018-01-101-1/+1
| | | | | | | | | | | Currently these files are being installed into a root installation directory, but this triggers an error when the installation directory is set to an empty string which is often the case when DESTDIR is used to control the installation destination. Differential Revision: https://reviews.llvm.org/D41673 llvm-svn: 322234
* [hwasan] An option to disable tag randomization.Evgeniy Stepanov2018-01-102-6/+14
| | | | | | | | | | | | | | | | | | Summary: Avoid flaky test failures by by using a monotonic number sequence of heap tags. Does not affect stack tags: the way we generate those guarantees uniqueness for at least 30-something first allocas in any function, as well as the UAR tag. Reviewers: alekseyshl, kcc Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D41882 llvm-svn: 322214
* Revert "[CMake] Install resource files into a share/ directory"Petr Hosek2018-01-101-1/+1
| | | | | | This reverts commit r322153 because it broke the sanitizer bots. llvm-svn: 322156
* [CMake] Install resource files into a share/ directoryPetr Hosek2018-01-101-1/+1
| | | | | | | | | | | Currently these files are being installed into a root installation directory, but this triggers an error when the installation directory is set to an empty string which is often the case when DESTDIR is used to control the installation destination. Differential Revision: https://reviews.llvm.org/D41673 llvm-svn: 322153
OpenPOWER on IntegriCloud