summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [libFuzzer] add one more value profile metric, under a flag (experimental)Kostya Serebryany2018-07-034-6/+13
| | | | llvm-svn: 336234
* [libFuzzer] remove stale code, as suggested in https://reviews.llvm.org/D48800Kostya Serebryany2018-07-031-7/+0
| | | | llvm-svn: 336230
* [scudo] Get rid of builtin-declaration-mismatch warningsKostya Kortchinsky2018-07-031-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The C interceptors were using `SIZE_T` defined in the interception library as a `__sanitizer::uptr`. On some 32-bit platforms, this lead to the following warning: ``` warning: declaration of ‘void* malloc(SIZE_T)’ conflicts with built-in declaration ‘void* malloc(unsigned int)’ [-Wbuiltin-declaration-mismatch] INTERCEPTOR_ATTRIBUTE void *malloc(SIZE_T size) { ``` `__sanitizer::uptr` is indeed defined as an `unsigned long` on those. So just include `stddef.h` and use `size_t` instead. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48885 llvm-svn: 336221
* [scudo] Enable Scudo memory hooks for Fuchsia.Kostya Kortchinsky2018-07-021-2/+6
| | | | | | | | | | | | | | | | | Summary: It would be useful for Flutter apps, especially, to be able to use malloc hooks to debug memory leaks on Fuchsia. They're not able to do this right now, so it'd be a nice bonus to throw in with the Scudo switchover. Reviewers: cryptoad, alekseyshl Reviewed By: cryptoad Differential Revision: https://reviews.llvm.org/D48618 llvm-svn: 336139
* [asan] Fix deadlock issue on FreeBSD, caused by use of .preinit_array in ↵Fangrui Song2018-07-012-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | rL325240 Summary: Without this patch, clang -fsanitize=address -xc =(printf 'int main(){}') -o a; ./a => deadlock in __asan_init>AsanInitInternal>AsanTSDInit>...>__getcontextx_size>_rtld_bind>rlock_acquire(rtld_bind_lock, &lockstate) libexec/rtld-elf/rtld.c wlock_acquire(rtld_bind_lock, &lockstate); if (obj_main->crt_no_init) preinit_main(); // unresolved PLT functions cannot be called here lib/libthr/thread/thr_rtld.c uc_len = __getcontextx_size(); // unresolved PLT function in libthr.so.3 check-xray tests currently rely on .preinit_array so we special case in xray_init.cc Subscribers: srhines, kubamracek, krytarowski, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48806 llvm-svn: 336067
* [asan] Use MADV_NOCORE for use_madv_dontdump on FreeBSD.Fangrui Song2018-06-301-1/+3
| | | | | | | | | | | | | | | | Currently in FreeBSD 12.0-CURRENT with trunk clang+compiler-rt, faulty -fsanitize=address executable hangs at 'urdlck' state. Ka Ho Ng has verified that by backporting this to llvm 6.0.1, with use_madv_dontdump=1, shadow memory is not dumped. ASAN_OPTIONS=abort_on_error=1:disable_coredump=0:use_madv_dontdump=1 ./a Reviewers: dimitry, kcc, dvyukov, emaste, khng300 Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48257 llvm-svn: 336046
* [profile] Add llvm_gcov_flush to be called outside a shared libraryChih-Hung Hsieh2018-06-291-0/+10
| | | | | | | | | | __gcov_flush is hidden. For applications to dump profiling data of selected .so files, they can use dlsym to find and call llvm_gcov_flush in each .so file. Differential Revision: https://reviews.llvm.org/D45454 llvm-svn: 336019
* [TSan] More detailed error message on failed sahdow memory madviseAlex Shlyapnikov2018-06-281-3/+10
| | | | | | | | | | | | | | Summary: Report errno value on failed shadow memory madvise attempt and add a hint message with the possible workaround. Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48668 llvm-svn: 335928
* [sanitizer] zx_cprng_draw no longer returns any valuePetr Hosek2018-06-271-1/+1
| | | | | | | | Remove the return value check. Differential Revision: https://reviews.llvm.org/D48671 llvm-svn: 335790
* [UBSan] Add silence_unsigned_overflow flag.Matt Morehouse2018-06-272-0/+7
| | | | | | | | | | | | | | | | | | | | Summary: Setting UBSAN_OPTIONS=silence_unsigned_overflow=1 will silence all UIO reports. This feature, combined with -fsanitize-recover=unsigned-integer-overflow, is useful for providing fuzzing signal without the excessive log output. Helps with https://github.com/google/oss-fuzz/issues/910. Reviewers: kcc, vsk Reviewed By: vsk Subscribers: vsk, kubamracek, Dor1s, llvm-commits Differential Revision: https://reviews.llvm.org/D48660 llvm-svn: 335762
* [sanitizer] zx_cprng_draw no longer takes the output argumentPetr Hosek2018-06-271-3/+1
| | | | | | | | The zx_cprng_draw system call no longer takes the output argument. Differential Revision: https://reviews.llvm.org/D48657 llvm-svn: 335755
* [CMake] Tidy up the organisation of compiler-rt when configured as a standaloneDan Liew2018-06-272-0/+4
| | | | | | | | | | | | | | | | | | | build with an IDE (e.g. Xcode) as the generator. Previously the global `USE_FOLDERS` property wasn't set in standalone builds leading to existing settings of FOLDER not being respected. In addition to this there were several targets that appeared at the top level that were not interesting and clustered up the view. These have been changed to be displayed in "Compiler-RT Misc". Now when an Xcode project is generated from a standalone compiler-rt build the project navigator is much less cluttered. The interesting libraries should appear in "Compiler-RT Libraries" in the IDE. Differential Revision: https://reviews.llvm.org/D48378 llvm-svn: 335728
* CFI: Print DSO names for failed cross-DSO icallsVlad Tsyrklevich2018-06-262-8/+32
| | | | | | | | | | | | Reviewers: pcc Reviewed By: pcc Subscribers: kubamracek, delcypher, llvm-commits, kcc, #sanitizers Differential Revision: https://reviews.llvm.org/D48583 llvm-svn: 335644
* [libFuzzer] Do not turn unittest warnings into errors.Matt Morehouse2018-06-261-1/+0
| | | | | | | | Some warnings originating from googletest were causing bots to fail while bulding unit tests. The sanitizers address this issue by not using -Werror. We adopt this approach for libFuzzer. llvm-svn: 335640
* Implement CFI for indirect calls via a member function pointer.Peter Collingbourne2018-06-263-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Similarly to CFI on virtual and indirect calls, this implementation tries to use program type information to make the checks as precise as possible. The basic way that it works is as follows, where `C` is the name of the class being defined or the target of a call and the function type is assumed to be `void()`. For virtual calls: - Attach type metadata to the addresses of function pointers in vtables (not the functions themselves) of type `void (B::*)()` for each `B` that is a recursive dynamic base class of `C`, including `C` itself. This type metadata has an annotation that the type is for virtual calls (to distinguish it from the non-virtual case). - At the call site, check that the computed address of the function pointer in the vtable has type `void (C::*)()`. For non-virtual calls: - Attach type metadata to each non-virtual member function whose address can be taken with a member function pointer. The type of a function in class `C` of type `void()` is each of the types `void (B::*)()` where `B` is a most-base class of `C`. A most-base class of `C` is defined as a recursive base class of `C`, including `C` itself, that does not have any bases. - At the call site, check that the function pointer has one of the types `void (B::*)()` where `B` is a most-base class of `C`. Differential Revision: https://reviews.llvm.org/D47567 llvm-svn: 335569
* [HWASan] Initalize shadow earler.Alex Shlyapnikov2018-06-251-4/+4
| | | | | | | | | | | | | | Summary: Initialize shadow memory before calling more libc functions to allow for HWASan-instrumented libc. Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48551 llvm-svn: 335502
* [libFuzzer] Use Vector rather than std::vector.Matt Morehouse2018-06-251-1/+1
| | | | llvm-svn: 335487
* [ubsan] Fix __ubsan_on_report interface definitionVedant Kumar2018-06-222-1/+2
| | | | | | | | | | | | | | | | Speculative fix for the interface definition of __ubsan_on_report for the Windows bots: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/30528 lib\ubsan\ubsan_interface.inc(55): error C2065: '__ubsan_on_report': undeclared identifier INTERCEPT_SANITIZER_WEAK_FUNCTION was the wrong macro to use to begin with because __ubsan_on_report isn't weak. Reading through that macro, it's still not clear to me why there is an undefined reference, though, because it appears to define a dummy __ubsan_on_report shim. llvm-svn: 335383
* [ubsan] Add support for reporting diagnostics to a monitor processVedant Kumar2018-06-228-59/+209
| | | | | | | | | | | | | | | | | | Add support to the ubsan runtime for reporting diagnostics to a monitor process (e.g a debugger). The Xcode IDE uses this by setting a breakpoint on __ubsan_on_report and collecting diagnostic information via __ubsan_get_current_report_data, which it then surfaces to users in the editor UI. Testing for this functionality already exists in upstream lldb, here: lldb/packages/Python/lldbsuite/test/functionalities/ubsan Apart from that, this is `ninja check-{a,ub}san` clean. Differential Revision: https://reviews.llvm.org/D48446 llvm-svn: 335371
* tsan: fix deficiency in MutexReadOrWriteUnlockDmitry Vyukov2018-06-221-1/+1
| | | | | | | | | | MutexUnlock uses ReleaseStore on s->clock, which is the right thing to do. However MutexReadOrWriteUnlock for writers uses Release on s->clock. Make MutexReadOrWriteUnlock also use ReleaseStore for consistency and performance. Unfortunately, I don't think any test can detect this as this only potentially affects performance. llvm-svn: 335322
* [scudo] Add a minimal runtime for -fsanitize-minimal-runtime compatibilityKostya Kortchinsky2018-06-211-8/+34
| | | | | | | | | | | | | | | | | | | Summary: This patch follows D48373. The point is to be able to use Scudo with `-fsanitize-minimal-runtime`. For that we need a runtime that doesn't embed the UBSan one. This results in binaries that can be compiled with `-fsanitize=scudo,integer -fsanitize-minimal-runtime`. Reviewers: eugenis Reviewed By: eugenis Subscribers: mgorny, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48377 llvm-svn: 335296
* [tsan] Use DARWIN_osx_LINK_FLAGS when building unit tests to match ASan ↵Kuba Mracek2018-06-211-0/+1
| | | | | | behavior. llvm-svn: 335265
* [TSan] fix build and couple of unit tests on FreeBSDDavid Carlier2018-06-201-1/+4
| | | | | | | | | | | | | Similarly to Msan adding -pie provokes linkage issue, was spotted with pie_test.cc Set to XFAIL for couple of unit tests. Reviewers: vitalybuka, krytarowski, dim Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D48317 llvm-svn: 335166
* [Lsan] intercept thr_exit on FreeBSDDavid Carlier2018-06-202-3/+16
| | | | | | | | | | | | | | Intercepts thr_exit call on FreeBSD. Disable pthread key workflow. The pthread key create approach does not function under FreeBSD as the libpthread is not initialised enough at this stage. Reviewers: vitalybuka, krytarowski, dim Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D48268 llvm-svn: 335164
* [Sanitizers] Remove OOM/BadRequest allocator error handling policies.Alex Shlyapnikov2018-06-206-68/+43
| | | | | | | | | | | | | | | | | | | Summary: Remove the generic error nadling policies and handle each allocator error explicitly. Although more verbose, it allows for more comprehensive, precise and actionable allocator related failure reports. This finishes up the series of changes of the particular sanitizer allocators, improves the internal allocator error reporting and removes now unused policies. Reviewers: vitalybuka, cryptoad Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48328 llvm-svn: 335147
* [XRay] Fix error message. NFCFangrui Song2018-06-191-2/+2
| | | | | | | | | | Reviewers: dberris Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48313 llvm-svn: 335055
* [scudo] Move noinline functions definitions out of lineKostya Kortchinsky2018-06-191-63/+67
| | | | | | | | | | | | | | | | Summary: Mark `isRssLimitExceeded` as `NOINLINE`, and move it's definition as well as the one of `performSanityChecks` out of the class definition, as requested. Reviewers: filcab, alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48228 llvm-svn: 335054
* Fix bots after r334981Francis Visoiu Mistrih2018-06-191-19/+19
| | | | llvm-svn: 335013
* [asan] Avoid deadlock when initializing the symbolizer CHECK failsReid Kleckner2018-06-191-2/+8
| | | | llvm-svn: 335007
* Fixing os_version_check.c to be actual C sourceChris Bieneman2018-06-181-27/+50
| | | | | | | | | The initial implementaiton was using the C++ typeof keyword. This causes the compiler to spew warnings unnecissarilly. This patch removes the uses of typeof and replaces them with explicit typedefs of the function types. llvm-svn: 334981
* [TSan] Report proper error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-06-186-53/+67
| | | | | | | | | | | | | | | | | | | | | | Summary: Following up on and complementing D44404 and other sanitizer allocators. Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, no stack, no details, not too helpful nor informative. To improve the situation, detailed and structured common errors were defined and reported under the appropriate conditions. Common tests were generalized a bit to cover a slightly different TSan stack reporting format, extended to verify errno value and returned pointer value check is now explicit to facilitate debugging. Reviewers: dvyukov Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48087 llvm-svn: 334975
* [sanitizer] Guard call to internal_lseek when SANITIZER_MAC is trueFrancis Visoiu Mistrih2018-06-181-1/+1
| | | | | | | | | | r334881 breaks macOS bots because internal_lseek is not defined (neither used on macOS): http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/46240/consoleFull. See discussion from r334881: https://reviews.llvm.org/rL334881 llvm-svn: 334944
* [Fuzzer] Set an explicit libc++ dependency when neededPetr Hosek2018-06-181-2/+6
| | | | | | | | | | | | | On targets that don't link internal libc++ (Fuchsia and Linux) but use libc++ as their C++ library and libFuzzer is being built using the just built compiler together with libc++ as part of runtimes, we need an explicit dependency from libFuzzer object library to libc++ to make sure the headers are available by the time we start building libFuzzer. Differential Revision: https://reviews.llvm.org/D48261 llvm-svn: 334928
* [sanitizer] Suppress unused function warningVitaly Buka2018-06-181-1/+2
| | | | llvm-svn: 334923
* [sanitizer] Fix tsan GO buildVitaly Buka2018-06-171-20/+20
| | | | llvm-svn: 334914
* [sanitizer] Fix s390 build after r334900Vitaly Buka2018-06-171-1/+1
| | | | llvm-svn: 334913
* [sanitizer] Use confstr to check libc version in InitTlsSizeVitaly Buka2018-06-172-39/+66
| | | | | | | | | | Reviewers: Lekensteyn, jakubjelinek Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D48265 llvm-svn: 334912
* [fuzzer] Python 3 print fixesVitaly Buka2018-06-172-4/+4
| | | | llvm-svn: 334902
* [fuzzer] Fix collect_data_flow.py for python 3Vitaly Buka2018-06-171-1/+1
| | | | llvm-svn: 334901
* [sanitizer] Use const char* in internal_simple_strtollVitaly Buka2018-06-177-8/+8
| | | | llvm-svn: 334900
* [sanitizer_common] Fix windows build caused by r334881Fangrui Song2018-06-161-1/+3
| | | | llvm-svn: 334884
* [sanitizer_common] Use O_TRUNC for WrOnly access mode.Fangrui Song2018-06-163-2/+8
| | | | | | | | | | | | Summary: Otherwise if the file existed and was larger than the write size before the OpenFile call, the file will not be truncated and contain garbage in trailing bytes. Reviewers: glider, kcc, vitalybuka Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48250 llvm-svn: 334881
* [Fuzzer] Don't hardcode target architecture for Fuzzer testsPetr Hosek2018-06-151-32/+34
| | | | | | | | | Don't hardcode the architecture for Fuzzer tests which breaks when compiler-rt is being compiled for architectures other than x86_64. Differential Revision: https://reviews.llvm.org/D48207 llvm-svn: 334852
* [scudo] Add verbose failures in place of CHECK(0)Kostya Kortchinsky2018-06-156-25/+158
| | | | | | | | | | | | | | | | | | | | | | | | Summary: The current `FailureHandler` mechanism was fairly opaque with regard to the failure reason due to using `CHECK(0)`. Scudo is a bit different from the other Sanitizers as it prefers to avoid spurious processing in its failure path. So we just `dieWithMessage` using a somewhat explicit string. Adapted the tests for the new strings. While this takes care of the `OnBadRequest` & `OnOOM` failures, the next step is probably to migrate the other Scudo failures in the same failes (header corruption, invalid state and so on). Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: filcab, mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48199 llvm-svn: 334843
* [compiler-rt] [builtins] Don't build __atomic_* by default.Eli Friedman2018-06-141-2/+2
| | | | | | | | | | | The locks need to be implemented in a shared library to work correctly, so they shouldn't be part of libclang_rt.builtins.a, except in specialized scenarios where the user can prove it will only be linked once. Differential Revision: https://reviews.llvm.org/D47606 llvm-svn: 334779
* [libFuzzer] [NFC] Support multi-arch and multi-OS building and testingGeorge Karpenkov2018-06-142-3/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D47296 llvm-svn: 334768
* [MSan] Linker-initialize static fallback_mutex in msan_allocator.ccAlex Shlyapnikov2018-06-141-1/+1
| | | | | | | | | | | | | | | | Summary: static fallback_mutex in msan_allocator.cc does not need the ctor call and can be linker initialized. Issue: https://github.com/google/sanitizers/issues/194 Reviewers: morehouse, eugenis Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48145 llvm-svn: 334749
* [ASan] Linker-initialize static ScopedInErrorReport::current_error_.Alex Shlyapnikov2018-06-142-1/+2
| | | | | | | | | | | | | | | | | | | Summary: Static ScopedInErrorReport::current_error_ can be linker initialized to shave one global ctor call on application startup and be __asan_init-safe. Global constructors in ASan runtime are bad because __asan_init runs from preinit_array, before any such constructors. Issue: https://github.com/google/sanitizers/issues/194 Reviewers: eugenis, morehouse Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48141 llvm-svn: 334748
* [ASAN] fix typos and disable long-object-path test for win32Peter Wu2018-06-141-2/+2
| | | | | | | | Glob patterns seem unsupported for commands executed by the emulated shell (LIT_USE_INTERNAL_SHELL=1). Disable the test while that is being addressed (a workaround such as "cd a-*" also does not work). llvm-svn: 334719
* [scudo] Make Secondary linker-initialized compliantKostya Kortchinsky2018-06-141-6/+2
| | | | | | | | | | | | | | | | Summary: As a follow up to D48142 for Scudo, switch the `SpinMutex` to its static counterpart, and ensure zero-initialization by memset'ing the whole class. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48148 llvm-svn: 334716
OpenPOWER on IntegriCloud