summaryrefslogtreecommitdiffstats
path: root/compiler-rt
Commit message (Collapse)AuthorAgeFilesLines
...
* [xray] Detect MPROTECT and error out when it's enabled (on NetBSD)Michal Gorny2018-12-237-0/+38
| | | | | | | | | | Add a CheckMPROTECT() routine to detect when pax MPROTECT is enabled on NetBSD, and error xray out when it is. The solution is adapted from existing CheckASLR(). Differential Revision: https://reviews.llvm.org/D56049 llvm-svn: 350030
* [xray] Disable alignas() for thread_local objects on NetBSDMichal Gorny2018-12-233-2/+14
| | | | | | | | | | | | | | | | Disable enforcing alignas() for structs that are used as thread_local data on NetBSD. The NetBSD ld.so implementation is buggy and does not enforce correct alignment; however, clang seems to take it for granted and generates instructions that segv on wrongly aligned objects. Therefore, disable those alignas() statements on NetBSD until we can establish a better fix. Apparently, std::aligned_storage<> does not have any real effect at the moment, so we can leave it as-is. Differential Revision: https://reviews.llvm.org/D56000 llvm-svn: 350029
* Set the default SANITIZER_CXX_ABI library to libc++ for FreeBSD, andDimitry Andric2018-12-231-1/+1
| | | | | | also mark it as a system library, like on macOS. llvm-svn: 350020
* [Sanitizer] Enable POSIX regex api on FreeBSD.David Carlier2018-12-225-43/+27
| | | | | | | | | | | | | | | | | Reviewers: krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D56009 M lib/sanitizer_common/sanitizer_common_interceptors.inc M lib/sanitizer_common/sanitizer_platform_interceptors.h M lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc M lib/sanitizer_common/sanitizer_platform_limits_freebsd.h D test/sanitizer_common/TestCases/NetBSD/regex.cc A + test/sanitizer_common/TestCases/Posix/regex.cc llvm-svn: 350002
* Add support for LLVM profile for NetBSDKamil Rytarowski2018-12-225-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | Summary: NetBSD uses typical UNIX interfaces. All tests pass except instrprof-dlopen-dlclose-gcov.test, as there is not supported semantics of atexit(3) in dlopen(3)ed+dlclose(3)d DSO. NetBSD also ships an older version of LLVM profile (ABI v.2 predating ABI v.4 in upstream version) inside libc. That copy has been manually removed during the porting and testing process of the upstream version to NetBSD. Otherwise there were conflicts between them two. Reviewers: joerg, vitalybuka, vsk Subscribers: srhines, fedor.sergeev, llvm-commits, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55997 llvm-svn: 349994
* Fix comment typo.Dan Liew2018-12-211-1/+1
| | | | llvm-svn: 349961
* Fix `static_assert()` scope in `CombinedAllocator`.Dan Liew2018-12-211-6/+7
| | | | | | | | | | | | | It should be at the class scope and not inside the `Init(...)` function because we want to error out as soon as the wrong type is constructed. At the function scope the `static_assert` is only checked if the function might be called. This is a follow up to r349957. rdar://problem/45284065 llvm-svn: 349960
* Fix `static_assert()` scope in `SizeClassAllocator32`.Dan Liew2018-12-211-3/+4
| | | | | | | | | | | | | It should be at the class scope and not inside the `Init(...)` function because we want to error out as soon as the wrong type is constructed. At the function scope the `static_assert` is only checked if the function might be called. This is a follow up to r349138. rdar://problem/45284065 llvm-svn: 349959
* Introduce `AddressSpaceView` template parameter to `CombinedAllocator`.Dan Liew2018-12-215-11/+42
| | | | | | | | | | | | | | | | | | | | | | Summary: This is a follow up to https://reviews.llvm.org/D55764 . For the ASan and LSan allocatorsthe type declarations have been modified so that it's possible to create a combined allocator type that consistently uses a different type of `AddressSpaceView`. We intend to use this in future patches. For the other sanitizers they just use `LocalAddressSpaceView` by default because we have no plans to use these allocators in an out-of-process manner. rdar://problem/45284065 Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov, yln Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55766 llvm-svn: 349957
* Introduce `AddressSpaceView` template parameter to `SizeClassAllocator64`.Dan Liew2018-12-217-10/+57
| | | | | | | | | | | | | | | | | | | | | | Summary: This is a follow up patch to r349138. This patch makes a `AddressSpaceView` a type declaration in the allocator parameters used by `SizeClassAllocator64`. For ASan, LSan, and the unit tests the AP64 declarations have been made templated so that `AddressSpaceView` can be changed at compile time. For the other sanitizers we just hard-code `LocalAddressSpaceView` because we have no plans to use these allocators in an out-of-process manner. rdar://problem/45284065 Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55764 llvm-svn: 349954
* [Sanitizer] Move the unit test in the right place.David Carlier2018-12-211-0/+0
| | | | llvm-svn: 349917
* [Sanitizer] Enable strtonum in FreeBSDDavid Carlier2018-12-212-1/+3
| | | | | | | | | | Reviewers: krytarowski, vitalybuka Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55993 llvm-svn: 349916
* [xray] [tests] Detect and handle missing LLVMTestingSupport gracefullyMichal Gorny2018-12-213-4/+34
| | | | | | | | | | | | | | | | | | Add a code to properly test for presence of LLVMTestingSupport library when performing a stand-alone build, and skip tests requiring it when it is not present. Since the library is not installed, llvm-config reported empty --libs for it and the tests failed to link with undefined references. Skipping the two fdr_* test files is better than failing to build, and should be good enough until we find a better solution. NB: both installing LLVMTestingSupport and building it automatically from within compiler-rt sources are non-trivial. The former due to dependency on gtest, the latter due to tight integration with LLVM source tree. Differential Revision: https://reviews.llvm.org/D55891 llvm-svn: 349899
* [CMake] Print out the list of sanitizers that the sanitizer_common tests ↵Dan Liew2018-12-211-0/+7
| | | | | | | | | | | | | | | | will run against. Summary: This is a change requested by Vitaly Buka as prerequisite to landing https://reviews.llvm.org/D55740. Reviewers: vitalybuka, kubamracek Subscribers: mgorny, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55939 llvm-svn: 349897
* Revert "[asan] Disable test on powerpc64be"Vitaly Buka2018-12-201-3/+0
| | | | | | | | Now the test is passing on that bot. Some incremental build issues? This reverts commit e00b5a5229ae02088d9f32a4e328eaa08abaf354. llvm-svn: 349852
* [asan] Disable test on powerpc64beVitaly Buka2018-12-201-0/+3
| | | | llvm-svn: 349844
* [sanitizer] Support running without fd 0,1,2.Evgeniy Stepanov2018-12-207-9/+75
| | | | | | | | | | | | | | | | | | | Summary: Support running with no open file descriptors (as may happen to "init" process on linux). * Remove a check that writing to stderr succeeds. * When opening a file (ex. for log_path option), dup the new fd out of [0, 2] range to avoid confusing the program. (2nd attempt, this time without the sanitizer_rtems change) Reviewers: pcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D55801 llvm-svn: 349817
* [Sanitizer] Enable vis api on FreeBSDDavid Carlier2018-12-204-1/+8
| | | | | | | | | | Reviewers: krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D55923 llvm-svn: 349762
* Revert "[sanitizer] Support running without fd 0,1,2."Ilya Biryukov2018-12-208-76/+10
| | | | | | | | This reverts commit r349699. Reason: the commit breaks compilation of sanitizer_rtems.cc when building for RTEMS. llvm-svn: 349745
* [asan] Revert still Androind incompatible tests enabled in r349736Vitaly Buka2018-12-202-0/+4
| | | | llvm-svn: 349740
* [asan] Fix and re-enable few test on AndroidVitaly Buka2018-12-206-38/+23
| | | | llvm-svn: 349736
* [HWASAN] Add support for memory intrinsicsEugene Leviant2018-12-206-60/+172
| | | | | | | | | This is patch complements D55117 implementing __hwasan_mem* functions in runtime Differential revision: https://reviews.llvm.org/D55554 llvm-svn: 349730
* Remove pointless casts.Evgeniy Stepanov2018-12-201-2/+2
| | | | llvm-svn: 349717
* [asan] Disable test incompatible with new AndroidVitaly Buka2018-12-201-0/+4
| | | | llvm-svn: 349705
* [sanitizer] Support running without fd 0,1,2.Evgeniy Stepanov2018-12-198-10/+76
| | | | | | | | | | | | | | | | | Summary: Support running with no open file descriptors (as may happen to "init" process on linux). * Remove a check that writing to stderr succeeds. * When opening a file (ex. for log_path option), dup the new fd out of [0, 2] range to avoid confusing the program. Reviewers: pcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D55801 llvm-svn: 349699
* [sanitizer] Remove spurious semi-colonKostya Kortchinsky2018-12-191-1/+1
| | | | | | | | | | | | | | | | | | | Summary: An extra ';' at the end of a namespace triggers a pedantic warning: ``` .../sanitizer_common/sanitizer_type_traits.h:42:2: warning: extra ‘;’ [-Wpedantic] }; // namespace __sanitizer ``` Reviewers: eugenis, delcypher Reviewed By: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55849 llvm-svn: 349666
* [sanitizer_common] Fix sha2 interceptors not to use vars in array lenMichal Gorny2018-12-191-1/+2
| | | | | | | | | | | | Fix the sha2 interceptor macros to use a constant for array parameter length rather than referencing the extern variable. Since the digest length is provided in hash name, reuse the macro parameter for it. Verify that the calculated value matches the one provided by system headers. Differential Revision: https://reviews.llvm.org/D55811 llvm-svn: 349645
* [compiler-rt][builtins][PowerPC] Enable builtins tests on PowerPC 64 bit LEAmy Kwan2018-12-197-15/+17
| | | | | | | | | | | | This patch aims to enable the tests for the compiler-rt builtin functions (that currently already exist within compiler-rt) for PowerPC 64bit LE (ppc64le). Previously when unit tests are run, these tests would be reported as UNSUPPORTED. This patch updates the REQUIRES line for each test (to enable for ppc64le), and each test is linked against compiler-rt when running. Differential Revision: https://reviews.llvm.org/D54449 llvm-svn: 349634
* Reimplement Thread Static Data ASan routines with TLSKamil Rytarowski2018-12-191-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Thread Static Data cannot be used in early init on NetBSD and FreeBSD. Reuse the ASan TSD API for compatibility with existing code with an alternative implementation using Thread Local Storage. New version uses Thread Local Storage to store a pointer with thread specific data. The destructor from TSD has been replaced with a TLS destrucutor that is called upon thread exit. Reviewers: joerg, vitalybuka, jfb Reviewed By: vitalybuka Subscribers: dim, emaste, ro, jfb, devnexen, kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D55596 llvm-svn: 349619
* tsan: align default value of detect_deadlocks flag with actual behaviorDmitry Vyukov2018-12-194-9/+8
| | | | | | | | | | | | | | I tricked myself into thinking that deadlock detection is off by default in TSan by looking at the default value of the detect_deadlocks flag and outdated docs. (Created a pull request to update docs.) I even managed to confuse others: https://groups.google.com/forum/#!topic/thread-sanitizer/xYvnAYwtoDk However, the default value is overwritten in code (TSan_flags.cc:InitializeFlags). The TSan/deadlock tests also rely on this This changes aligns the default value of the flag with the actual default behavior. Author: yln (Julian Lettner) Reviewed in: https://reviews.llvm.org/D55846 llvm-svn: 349609
* [asan] Disable ODR test on AndroidVitaly Buka2018-12-191-0/+3
| | | | llvm-svn: 349585
* [asan] Restore ODR-violation detection on vtablesVitaly Buka2018-12-181-0/+26
| | | | | | | | | | | | | | | | | | | Summary: unnamed_addr is still useful for detecting of ODR violations on vtables Still unnamed_addr with lld and --icf=safe or --icf=all can trigger false reports which can be avoided with --icf=none or by using private aliases with -fsanitize-address-use-odr-indicator Reviewers: eugenis Reviewed By: eugenis Subscribers: kubamracek, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D55799 llvm-svn: 349555
* Fix a gcc -Wpedantix warningNico Weber2018-12-181-1/+1
| | | | llvm-svn: 349492
* hwasan: Allow range of frame descriptors to be empty.Peter Collingbourne2018-12-181-2/+2
| | | | | | | | | As of r349413 it's now possible for a binary to contain an empty hwasan frame section. Handle that case simply by doing nothing. Differential Revision: https://reviews.llvm.org/D55796 llvm-svn: 349428
* Don't trigger sanitizer initialization from `sysctlbyname` and `sysctl` ↵Dan Liew2018-12-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | interceptor. Summary: This fixes the `ThreadSanitizer-x86_64-iossim` testsuite which broke when r348770 (https://reviews.llvm.org/D55473) landed. The root cause of the problem is that early-on during the iOS simulator init process a call to `sysctlbyname` is issued. If the TSan initializer is triggered at this point it will eventually trigger a call to `__cxa_at_exit(...)`. This call then aborts because the library implementing this function is not yet had its initialization function called. rdar://problem/46696934 Reviewers: kubamracek, george.karpenkov, devnexen, vitalybuka, krytarowski Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55711 llvm-svn: 349402
* [Sanitizer] capsicum variadic api subsetDavid Carlier2018-12-172-0/+78
| | | | | | | | | | Reviewers: markj, vitalybuka Reviewed By: markj Differential Revision: https://reviews.llvm.org/D55714 llvm-svn: 349392
* Improve the comment in previousKamil Rytarowski2018-12-161-2/+2
| | | | llvm-svn: 349296
* Expand TSan sysroot workaround to NetBSDKamil Rytarowski2018-12-161-5/+6
| | | | | | https://bugs.llvm.org/show_bug.cgi?id=26651 llvm-svn: 349295
* Enable test/msan/pthread_getname_np.cc for NetBSDKamil Rytarowski2018-12-151-1/+5
| | | | llvm-svn: 349263
* Enable SANITIZER_INTERCEPT_PTHREAD_GETNAME_NP for NetBSDKamil Rytarowski2018-12-151-1/+1
| | | | llvm-svn: 349262
* Fix internal_sleep() for NetBSDKamil Rytarowski2018-12-151-1/+1
| | | | | | This is a follow up of a similar fix for Linux from D55692. llvm-svn: 349257
* Fix typo in test cases as well.Peter Collingbourne2018-12-153-8/+8
| | | | llvm-svn: 349255
* hwasan: Fix typo: Previosly -> Previously.Peter Collingbourne2018-12-151-1/+1
| | | | llvm-svn: 349254
* [libFuzzer] make len_control less aggressiveKostya Serebryany2018-12-141-1/+1
| | | | llvm-svn: 349210
* Mark interception_failure_test.cc as passing for NetBSD and asan-dynamic-runtimeKamil Rytarowski2018-12-141-1/+5
| | | | llvm-svn: 349159
* Set shared_libasan_path in lit tests for NetBSDKamil Rytarowski2018-12-141-1/+1
| | | | | | Reuse the Linux code path. llvm-svn: 349156
* Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, ↵Dan Liew2018-12-1411-26/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `FlatByteMap`, and `TwoLevelByteMap`. Summary: This is a follow up patch to r346956 for the `SizeClassAllocator32` allocator. This patch makes `AddressSpaceView` a template parameter both to the `ByteMap` implementations (but makes `LocalAddressSpaceView` the default), some `AP32` implementations and is used in `SizeClassAllocator32`. The actual changes to `ByteMap` implementations and `SizeClassAllocator32` are very simple. However the patch is large because it requires changing all the `AP32` definitions, and users of those definitions. For ASan and LSan we make `AP32` and `ByteMap` templateds type that take a single `AddressSpaceView` argument. This has been done because we will instantiate the allocator with a type that isn't `LocalAddressSpaceView` in the future patches. For the allocators used in the other sanitizers (i.e. HWAsan, MSan, Scudo, and TSan) use of `LocalAddressSpaceView` is hard coded because we do not intend to instantiate the allocators with any other type. In the cases where untemplated types have become templated on a single `AddressSpaceView` parameter (e.g. `PrimaryAllocator`) their name has been changed to have a `ASVT` suffix (Address Space View Type) to indicate they are templated. The only exception to this are the `AP32` types due to the desire to keep the type name as short as possible. In order to check that template is instantiated in the correct a way a `static_assert(...)` has been added that checks that the `AddressSpaceView` type used by `Params::ByteMap::AddressSpaceView` matches the `Params::AddressSpaceView`. This uses the new `sanitizer_type_traits.h` header. rdar://problem/45284065 Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov Subscribers: mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D54904 llvm-svn: 349138
* [sanitizer] Fix nolibc internal_sleepFangrui Song2018-12-141-1/+1
| | | | | | | | | | | | Reviewers: kubamracek, vitalybuka Reviewed By: vitalybuka Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D55692 llvm-svn: 349134
* Windows ASan: Instrument _msize_base()Vlad Tsyrklevich2018-12-142-0/+7
| | | | | | | | | | | | | | | | | | | | Summary: A recent update to the VS toolchain in chromium [1] broke the windows ASan bot because the new toolchain calls _msize_base() instead of _msize() in a number of _aligned_* UCRT routines. Instrument _msize_base() as well. [1] https://crbug.com/914947 Reviewers: rnk, #sanitizers, vitalybuka Reviewed By: rnk, #sanitizers, vitalybuka Subscribers: vitalybuka, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D55684 llvm-svn: 349115
* Revert "Switch Android from TLS_SLOT_TSAN(8) to TLS_SLOT_SANITIZER(6)"Evgeniy Stepanov2018-12-131-5/+5
| | | | | | | | Breaks sanitizer-android buildbot. This reverts commit 85e02baff327e7b67ea5b47897302901abb2aa5d. llvm-svn: 349093
OpenPOWER on IntegriCloud