summaryrefslogtreecommitdiffstats
path: root/compiler-rt
Commit message (Collapse)AuthorAgeFilesLines
...
* Add Demangle lib into internalization listEugene Zemtsov2018-03-081-0/+1
| | | | | | Symbolizer now depends on internal implementation of itaniumDemangle. llvm-svn: 326983
* [sanitizer] Fix SANITIZER_INTERCEPT_MMAP and SANITIZER_INTERCEPT_MMAP64 valuesVitaly Buka2018-03-071-2/+2
| | | | llvm-svn: 326938
* [Fuzzer] Avoid the unnecessary rebuild of the custom libc++Petr Hosek2018-03-077-31/+70
| | | | | | | | | | | | This changes the add_custom_libcxx macro to resemble the llvm_ExternalProject_Add. The primary motivation is to avoid unnecessary libFuzzer rebuilds that are being done on every Ninja/Make invocation. The libc++ should be only rebuilt whenever the libc++ source itself changes. Differential Revision: https://reviews.llvm.org/D43213 llvm-svn: 326921
* [scudo] Make logging more consistentKostya Kortchinsky2018-03-075-65/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A few changes related to logging: - prepend `Scudo` to the error messages so that users can identify that we reported an error; - replace a couple of `Report` calls in the RSS check code with `dieWithMessage`/`Print`, mark a condition as `UNLIKELY` in the process; - change some messages so that they all look more or less the same. This includes the `CHECK` message; - adapt a couple of tests with the new strings. A couple of side notes: this results in a few 1-line-blocks, for which I left brackets. There doesn't seem to be any style guide for that, I can remove them if need be. I didn't use `SanitizerToolName` in the strings, but directly `Scudo` because we are the only users, I could change that too. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44171 llvm-svn: 326901
* Don't intercept mmap64() on NetBSDKamil Rytarowski2018-03-071-1/+1
| | | | | | | | | Disable SANITIZER_INTERCEPT_MMAP64 for SI_NETBSD. NetBSD switched to 64-bit offsets almost 30 years ago on 32-bit platforms and never needed mmap64() concept. llvm-svn: 326883
* Attempt to appease buildbotsGeorge Burgess IV2018-03-071-1/+1
| | | | | | | | | | | I can't reproduce this build error locally, but it appears straightforward enough to fix. r326851 renamed two of the params of this interceptor, but apparently to update their use here. Failure: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/4569 llvm-svn: 326876
* Disable tests from r326852 on DarwinAdam Nemet2018-03-072-0/+2
| | | | | | | | | | Darwin needs xlocale.h but I see no precedence in the code how non-Posix headers like this are handled and I am not experienced with this code. Just disable the tests for now to recover the bots. rdar://38208146 llvm-svn: 326874
* [XRay][compiler-rt] Add APIs for processing logs in memoryDean Michael Berris2018-03-073-5/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change adds APIs to allow logging implementations to provide a function for iterating through in-memory buffers (if they hold in-memory buffers) and a way for users to generically deal with these buffers in-process. These APIs are: - __xray_log_set_buffer_iterator(...) and __xray_log_remove_buffer_iterator(): installs and removes an iterator function that takes an XRayBuffer and yields the next one. - __xray_log_process_buffers(...): takes a function pointer that can take a mode identifier (string) and an XRayBuffer to process this data as they see fit. The intent is to have the FDR mode implementation's buffers be available through this `__xray_log_process_buffers(...)` API, so that they can be streamed from memory instead of flushed to disk (useful for getting the data to a network, or doing in-process analysis). Basic mode logging will not support this mechanism as it's designed to write the data mostly to disk. Future implementations will may depend on this API as well, to allow for programmatically working through the XRay buffers exposed to the users in some fashion. Reviewers: eizan, kpw, pelikan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43495 llvm-svn: 326866
* Fixup r326851: mmap64 interceptor should not be used on Darwin.Kuba Mracek2018-03-071-1/+1
| | | | llvm-svn: 326864
* [sanitizer] Update symbolizer testVitaly Buka2018-03-071-0/+1
| | | | llvm-svn: 326855
* [sanitizer] Extract common code into STRXFRM_INTERCEPTOR_IMPLVitaly Buka2018-03-071-48/+22
| | | | llvm-svn: 326854
* [sanitizer] Move strxfrm interceptors into sanitizer_commonVitaly Buka2018-03-074-38/+92
| | | | llvm-svn: 326853
* [sanitizer] Add interceptors for wcsxfrm, wcsxfrm_lVitaly Buka2018-03-074-0/+86
| | | | | | | | | | | | | | Patch by Oliver Chang Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44133 llvm-svn: 326852
* [sanitizer] Move mmap interceptors into sanitizer_commonVitaly Buka2018-03-078-137/+108
| | | | | | | | | | Reviewers: devnexen, krytarowski, eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44125 llvm-svn: 326851
* [XRay][compiler-rt] Make unit tests depend on implementation filesDean Michael Berris2018-03-061-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change makes changes to XRay implementation files trigger re-builds of the unit tests. Prior to this change, the unit tests were not built and run properly if the implementation files were changed during the development process. This change forces the dependency on all files in the XRay include and lib hosted files in compiler-rt. Caveat is, that new files added to the director(ies) will need a re-run of CMake to re-generate the fileset. We think this is an OK compromise, since adding new files may necessitate editing (or adding) new unit tests. It's also less likely that we're adding new files without updating the CMake configuration to include the functionality in the XRay runtime implementation anyway. Reviewers: pelikan, kpw, nglevin Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D44080 llvm-svn: 326842
* [scudo] Use gc-sections by defaultKostya Kortchinsky2018-03-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: If not using `-Wl,--gc-sections`, a whole lot of unused `sanitizer_common` code and related static variables are pulled into the shared library. Keep the binary size smaller, and its memory footprint smaller as well, by using the compiler flags `-ffunction-section` & `-fdata-sections` by default, as well as the linker flags `-Wl,--gc-sections`. Current experiments show a large discrepency between binary sizes generated by gcc (big) and clang (small). I am not sure yet how I can make a test that would encompass both, so it's an outstanding work item. Reviewers: alekseyshl, flowerhack Reviewed By: alekseyshl Subscribers: mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44121 llvm-svn: 326833
* OpenBSD sanitizer common, define RLIMIT_AS constantKamil Rytarowski2018-03-061-0/+2
| | | | | | | | | | | | | | | | Summary: define RLIMIT_AS constant until it s defined in the future Patch by: David Carlier Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44068 llvm-svn: 326768
* [sanitizer] Fix the return type for GetTid in Fuchsia implementationPetr Hosek2018-03-061-1/+1
| | | | | | | | | This is triggering "functions that differ only in their return type cannot be overloaded" error. Differential Revision: https://reviews.llvm.org/D44126 llvm-svn: 326759
* Remove more references to ptrace_pt_{g,s}et_sigmaskKamil Rytarowski2018-03-032-8/+0
| | | | | | | | | | These operations are now obsolete on NetBSD and will be removed. No functional change for other OSes. Sponsored by <The NetBSD Foundation> llvm-svn: 326663
* Fix NetBSD 32-bit buildKamil Rytarowski2018-03-031-1/+1
| | | | | | | | Replace 'defined(SANITIZER_OPENBSD)' with appropriate 'SANITIZER_OPENBSD'. This is a fallout from adding OpenBSD partial support. llvm-svn: 326662
* Remove obsolete ptrace(2) operations from NetBSDKamil Rytarowski2018-03-035-14/+2
| | | | | | | | | PT_SET_SIGMASK and PT_GET_SIGMASK will be removed from NetBSD without backward compat (it shortlived in a development branch). Sponsored by <The NetBSD Foundation> llvm-svn: 326657
* Revert D44035Kamil Rytarowski2018-03-032-111/+67
| | | | | | Broken syntax. llvm-svn: 326655
* Hotfix for D44035Kamil Rytarowski2018-03-031-1/+1
| | | | | | Try to fix the syntax. llvm-svn: 326654
* Support OpenBSD in common interceptorsKamil Rytarowski2018-03-032-67/+111
| | | | | | | | | | | | | | | | | | | | | | | Summary: Extract INIT_PTHREAD_ATTR_GET_SCHED from INIT_PTHREAD_ATTR_GET, as the former is not supported on OpenBSD. Supported interceptors getdetachstate, getguardsize, getscope, getstacksize, getgrouplist and getstack Unsupported getschedparam, getgroupmembership and getschedpolicy Patch by David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: fedor.sergeev, srhines, kubamracek, mgorny, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44035 llvm-svn: 326653
* OpenBSD UBsan support enabling SANITIZER_OPENBSD widelyKamil Rytarowski2018-03-038-13/+28
| | | | | | | | | | | | | | | | Summary: Adding OpenBSD platform Patch by: David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: srhines, kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44049 llvm-svn: 326651
* OpenBSD UBsan support / commonKamil Rytarowski2018-03-034-0/+762
| | | | | | | | | | | | | | | | | | | Summary: Sanitizer common, enable OpenBSD platform. - Enable common interceptors as possible and create few distinct ones. - Create necessary sanitizer_struct types. Patch by: David CARLIER Reviewers: krytarowski, vitalybuka, visa, kettenis Reviewed By: vitalybuka Subscribers: emaste, srhines, kubamracek, mgorny, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43909 llvm-svn: 326650
* [msan] Restrict -ftls-model=initial-exec to FreeBSDKamil Rytarowski2018-03-031-1/+3
| | | | | | Noted by <eugenis> in D43613 llvm-svn: 326649
* Sanitiser common, using u64 type for GetTid on posix systemsKamil Rytarowski2018-03-032-7/+5
| | | | | | | | | | | | | | | | | Summary: Moving from ptr to u64 for GetTid posix implementation. [FreeBSD] Moving from pthread_self to thr_self more appropriate to get thread ID. Patch by: David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43998 llvm-svn: 326647
* OpenBSD UBsan support, cmake partKamil Rytarowski2018-03-032-6/+15
| | | | | | | | | | | | | | | | | | Summary: On OpenBSD no multi arch support Enabling only UBsan and disabling Asan. Patch by: David CARLIER Reviewers: krytarowski, vitalybuka Reviewed By: vitalybuka Subscribers: srhines, mgorny, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44017 llvm-svn: 326646
* Adding Msan support to FreeBSDKamil Rytarowski2018-03-0316-8/+24
| | | | | | | | | | | | | | | | | | | | Summary: Enabling the memory sanitizer support for FreeBSD, most of unit tests are compatible. - Adding fstat and stressor_r interceptors. - Updating the struct link_map access since most likely the struct Obj_Entry had been updated since. - Disabling few unit tests until further work is needed (or we can assume it can work in real world code). Patch by: David CARLIER Reviewers: vitalybuka, krytarowski Reviewed By: vitalybuka Subscribers: eugenis, dim, srhines, emaste, kubamracek, mgorny, fedor.sergeev, hintonda, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43080 llvm-svn: 326644
* OpenBSD Ubsan support / interceptionKamil Rytarowski2018-03-023-10/+10
| | | | | | | | | | | | | | | | Summary: Interception, enabling OpenBSD platform Patch by: David CARLIER Reviewers: krytarowski, vitalybuka, visa Reviewed By: vitalybuka Subscribers: srhines, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43893 llvm-svn: 326544
* OpenBSD UBsan support / ubsan partKamil Rytarowski2018-03-021-1/+2
| | | | | | | | | | | | | | | | Summary: UBsan, enable OpenBSD platform Patch by: David CARLIER Reviewers: krytarowski, kettenis, visa, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, fedor.sergeev, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43894 llvm-svn: 326543
* [PATCH] [compiler-rt, RISCV] Support builtins for RISC-VShiva Chen2018-03-019-2/+177
| | | | | | | | | | | Summary: Support builtins for RISC-V, RV32 and RV64. Reviewers: asb, apazos, mgrang Differential Revision: https://reviews.llvm.org/D42958 llvm-svn: 326420
* [profile] Test the exported symbol set for empty programsVedant Kumar2018-02-281-2/+14
| | | | | | | | Programs without any code in them should export the exact same set of symbols as programs with code, at least on Darwin. This is done to make text-based API verification possible for certain Darwin frameworks. llvm-svn: 326351
* [RISCV] Force enable int128 for compiling long double routinesMandeep Singh Grang2018-02-281-0/+6
| | | | | | | | | | | | | | | | | Summary: For RISCV32, we must force enable int128 for compiling long double routines using the flag -fforce-enable-int128. Related clang patch: https://reviews.llvm.org/D43105 Reviewers: asb, kito-cheng, apazos, compnerd, howard.hinnant Reviewed By: kito-cheng Subscribers: shiva0217, efriedma, mgorny, hintonda, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43106 llvm-svn: 326346
* Disable ASan exceptions on NetBSDKamil Rytarowski2018-02-271-1/+2
| | | | | | | | | | | | | | | This is a workarond for the fallout from D42644: [asan] Intercept std::rethrow_exception indirectly. Reported problem on NetBSD/amd64: $ sh ./projects/compiler-rt/test/sanitizer_common/asan-i386-NetBSD/NetBSD/Output/ttyent.cc.script /usr/lib/i386/libgcc.a(unwind-dw2.o): In function `_Unwind_RaiseException': unwind-dw2.c:(.text+0x1b41): multiple definition of `_Unwind_RaiseException' /public/llvm-build/lib/clang/7.0.0/lib/netbsd/libclang_rt.asan-i386.a(asan_interceptors.cc.o):/public/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:337: first defined here clang-7.0: error: linker command failed with exit code 1 (use -v to see invocation) llvm-svn: 326216
* [scudo] Introduce Chunk::getHeaderSizeKostya Kortchinsky2018-02-273-25/+27
| | | | | | | | | | | | | | | | | | | | | Summary: Instead of using `AlignedChunkHeaderSize`, introduce a `constexpr` function `getHeaderSize` in the `Chunk` namespace. Switch `RoundUpTo` to a `constexpr` as well (so we can use it in `constexpr` declarations). Mark a few variables in the areas touched as `const`. Overall this has no functional change, and is mostly to make things a bit more consistent. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D43772 llvm-svn: 326206
* Add new interceptors: getnetent(3) familyKamil Rytarowski2018-02-274-0/+163
| | | | | | | | | | | | | | | | | | | | | Summary: getnetent, getnetbyaddr, getnetbyname - get network entry Reuse them on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43543 llvm-svn: 326163
* Add new interceptors: getprotoent(3) familyKamil Rytarowski2018-02-274-0/+167
| | | | | | | | | | | | | | | | | | | | | Summary: getprotoent, getprotobynumber, getprotobyname - get protocol entry Reuse them 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/D43541 llvm-svn: 326162
* Add new interceptors: getttyent(3) familyKamil Rytarowski2018-02-275-0/+121
| | | | | | | | | | | | | | | | | | | | | Summary: getttyent, getttynam, setttyentpath - get ttys file entry Reuse them on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43539 llvm-svn: 326161
* [asan] Enable ASAN_INTERCEPT___CXA_THROW for x86 AndroidVitaly Buka2018-02-271-4/+1
| | | | llvm-svn: 326160
* Fix build for iOS/ARM ("__Unwind_RaiseException" is not available for armv7).Kuba Mracek2018-02-261-1/+1
| | | | llvm-svn: 326150
* [asan] Fix build for AndroidVitaly Buka2018-02-261-2/+2
| | | | llvm-svn: 326149
* Fix which Darwin versions have ObjC runtime with full subscripting support.Volodymyr Sapsai2018-02-262-1/+7
| | | | | | | | | | | | | | | | | Update min deployment target in some tests so that they don't try to link against libarclite and don't fail when it's not available. rdar://problem/29253617 Reviewers: vsk, kubamracek Reviewed By: vsk Subscribers: jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D43787 llvm-svn: 326143
* Re-land "Emit proper CodeView when -gcodeview is passed without the cl driver."Reid Kleckner2018-02-261-0/+4
| | | | | | | Reverts r326116 and re-lands r326113 with a fix to ASan so that it enables column info in its test suite. llvm-svn: 326141
* [asan] Intercept std::rethrow_exception indirectlyVitaly Buka2018-02-263-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Fixes Bug 32434 See https://bugs.llvm.org/show_bug.cgi?id=32434 Short summary: std::rethrow_exception does not use __cxa_throw to rethrow the exception, so if it is called from uninstrumented code, it will leave the stack poisoned. This can lead to false positives. Long description: For functions which don't return normally (e.g. via exceptions), asan needs to unpoison the entire stack. It is not known before a call to such a function where execution will continue, some function which don't contain cleanup code like destructors might be skipped. After stack unwinding, execution might continue in uninstrumented code. If the stack has been poisoned before such a function is called, but the stack is unwound during the unconventional return, then zombie redzones (entries) for no longer existing stack variables can remain in the shadow memory. Normally, this is avoided by asan generating a call to asan_handle_no_return before all functions marked as [[noreturn]]. This asan_handle_no_return unpoisons the entire stack. Since these [[noreturn]] functions can be called from uninstrumented code, asan also introduces interceptor functions which call asan_handle_no_return before running the original [[noreturn]] function; for example, cxa_throw is intercepted. If a [[noreturn]] function is called from uninstrumented code (so the stack is left poisoned) and additionally, execution continues in uninstrumented code, new stack variables might be introduced and overlap with the stack variables which have been removed during stack unwinding. Since the redzones are not cleared nor overwritten by uninstrumented code, they remain but now contain invalid data. Now, if the redzones are checked against the new stack variables, false positive reports can occur. This can happen for example by the uninstrumented code calling an intercepted function such as memcpy, or an instrumented function. Intercepting std::rethrow_exception directly is not easily possible since it depends on the C++ standard library implementation (e.g. libcxx vs libstdc++) and the mangled name it produces for this function. As a rather simple workaround, we're intercepting _Unwind_RaiseException for libstdc++. For libcxxabi, we can intercept the ABI function __cxa_rethrow_primary_exception. Patch by Robert Schneider. Reviewers: kcc, eugenis, alekseyshl, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42644 llvm-svn: 326132
* Fix-up for r326106: FindAvailableMemoryRange needs a nullptr as its 5th ↵Kuba Mracek2018-02-261-2/+2
| | | | | | argument. llvm-svn: 326111
* [asan] Be more careful and verbose when allocating dynamic shadow memoryKuba Mracek2018-02-265-12/+36
| | | | | | | | FindAvailableMemoryRange can currently overwrite existing memory (by restricting the VM below addresses that are already used). This patch adds a check to make sure we don't restrict the VM space too much. We are also now more explicit about why the lookup failed and print out verbose values. Differential Revision: https://reviews.llvm.org/D43318 llvm-svn: 326106
* [MSan] Print current stack on CHECK violationAlex Shlyapnikov2018-02-263-2/+38
| | | | | | | | | | | | | | Summary: Print current stack on CHECK violation to aid debugging and match other sanitizers functionality. Reviewers: eugenis Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D43692 llvm-svn: 326105
* [scudo] Make some tests less Linux-yKostya Kortchinsky2018-02-265-44/+43
| | | | | | | | | | | | | | | | | | | | | Summary: Start making the Scudo tests less Linux-y: - `malloc_usable_size` doesn't exist everywhere, so replace them with `__sanitizer_get_allocated_size` which we provide; - move all the `memalign` related tests into `memalign.c` since it's also not available everywhere. I also noticed that the `memalign.c` was missing a line in one of the loops. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D43393 llvm-svn: 326100
OpenPOWER on IntegriCloud