summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-07-10[XRay][compiler-rt] xray::Array Freelist and Iterator UpdatesDean Michael Berris
Summary: We found a bug while working on a benchmark for the profiling mode which manifests as a segmentation fault in the profiling handler's implementation. This change adds unit tests which replicate the issues in isolation. We've tracked this down as a bug in the implementation of the Freelist in the `xray::Array` type. This happens when we trim the array by a number of elements, where we've been incorrectly assigning pointers for the links in the freelist of chunk nodes. We've taken the chance to add more debug-only assertions to the code path and allow us to verify these assumptions in debug builds. In the process, we also took the opportunity to use iterators to implement both `front()` and `back()` which exposes a bug in the iterator decrement operation. In particular, when we decrement past a chunk size boundary, we end up moving too far back and reaching the `SentinelChunk` prematurely. This change unblocks us to allow for contributing the non-crashing version of the benchmarks in the test-suite as well. Reviewers: kpw Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D48653 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336644 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-10Add lowercase OS name featureVlad Tsyrklevich
Summary: Some tests already make use of OS feature names, e.g. 'linux' and 'freebsd', but they are not actually currently set by lit. Reviewers: pcc, eugenis Reviewed By: eugenis Subscribers: emaste, krytarowski, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49115 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336633 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09[libFuzzer] Make -fsanitize=memory,fuzzer work.Matt Morehouse
This patch allows libFuzzer to fuzz applications instrumented with MSan without recompiling libFuzzer with MSan instrumentation. Fixes https://github.com/google/sanitizers/issues/958. Differential Revision: https://reviews.llvm.org/D48891 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336619 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09Revert "[libFuzzer] Mutation tracking and logging implemented"Matt Morehouse
This reverts r336597 due to bot breakage. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336616 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09[libFuzzer] Mutation tracking and logging implementedMatt Morehouse
Code now exists to track number of mutations that are used in fuzzing in total and ones that produce new coverage. The stats are currently being dumped to the command line. Patch By: Kode Williams Differntial Revision: https://reviews.llvm.org/D48054 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336597 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-09[ASan] Minor ASan error reporting cleanupAlex Shlyapnikov
Summary: - use proper Error() decorator for error messages - refactor ASan thread id and name reporting Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D49044 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336573 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-07Revert "Make __gcov_flush flush counters for all shared libraries"Michael Zolotukhin
This reverts r336365: the added tests are failing on various configurations (e.g. on green-dragon). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336474 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06libFuzzer: always print line-break for NEW_FUNC/PC outputKostya Serebryany
Summary: This is a minor cosmetic change. When function/path exceed ~1000 characters, the output is truncated before the line-break. I noticed this for NEW_FUNC. Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48799 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336461 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06Recommit "[CMake] Run libFuzzer tests with check-all."Yvan Roux
Since problematic tests on AArch64 were disabled at r336446. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336449 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06[MSan] Add functions to enable/disable interceptor checks.Matt Morehouse
Summary: The motivation for this change is to make libFuzzer+MSan possible without instrumenting libFuzzer. See https://github.com/google/sanitizers/issues/958. Reviewers: eugenis Reviewed By: eugenis Subscribers: llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D48890 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336447 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06[libFuzzer] Disable hanging tests on AArch64Yvan Roux
Disable problematic tests which broke AArch64 bots. Details available in Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=38034 Differential Revision: https://reviews.llvm.org/D49011 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336446 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06[scudo] Add some logs for AndroidKostya Kortchinsky
Summary: Namely, set the abort message, and allow to write the message to syslog if the option is enabled. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48902 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336445 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05Make __gcov_flush flush counters for all shared librariesMarco Castelluccio
Summary: This will make the behavior of __gcov_flush match the GCC behavior. I would like to rename __gcov_flush to __llvm_gcov_flush (in case of programs linking to libraries built with different compilers), but I guess we can't for compatibility reasons. Reviewers: davidxl Reviewed By: davidxl Subscribers: samsonov, vitalybuka, pcc, kcc, junbuml, glider, fhahn, eugenis, dvyukov, davidxl, srhines, chh, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D48538 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336365 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05Revert "[CMake] Run libFuzzer tests with check-all."Yvan Roux
Revert due to AArch64 bots breakage, upstream PR raised to track the issue: https://bugs.llvm.org/show_bug.cgi?id=38034 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336341 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04[libFuzzer] [NFC] Inline static variable to avoid the linker warning.George Karpenkov
Differential Revision: https://reviews.llvm.org/D48650 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336238 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03[libFuzzer] add one more value profile metric, under a flag (experimental)Kostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336234 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03[libFuzzer] remove stale code, as suggested in https://reviews.llvm.org/D48800Kostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336230 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03[libFuzzer] add a tiny and surprisingly hard puzzleKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336229 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03[scudo] Get rid of builtin-declaration-mismatch warningsKostya Kortchinsky
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336221 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03[scudo] Enable Scudo on PPC64Kostya Kortchinsky
Summary: In conjunction with the clang side change D48833, this will enable Scudo on PPC64. I tested `check-scudo` on a powerpc64le box and everything passes. Reviewers: eugenis, alekseyshl Reviewed By: alekseyshl Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48834 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336213 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-02[scudo] Enable Scudo memory hooks for Fuchsia.Kostya Kortchinsky
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336139 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-01[asan] Fix deadlock issue on FreeBSD, caused by use of .preinit_array in ↵Fangrui Song
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336067 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-30[UBsan] Enable subset of unit tests for OpenBSDDavid Carlier
Reviewers: kubamracek, krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D48805 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336053 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-30[asan] Use MADV_NOCORE for use_madv_dontdump on FreeBSD.Fangrui Song
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336046 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29[profile] Add llvm_gcov_flush to be called outside a shared libraryChih-Hung Hsieh
__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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336019 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29[cfi] Use __builtin version of __clear_cache.Evgeniy Stepanov
__builtin___clear_cache is also present on X86 and does the right thing (i.e. nop) there. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335997 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29[scs] Disable negative test in shadowcallstack.Evgeniy Stepanov
The test checks that scs does NOT work correctly w/o runtime support. That's a strange thing to test, and it is also flaky, because things may just work if x18 happens to point to a writable page. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335982 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29[scudo] Add some runtime tests for the minimal runtimeKostya Kortchinsky
Summary: As well as some tests to ensure that various combinations of the clang command line flags work (shared/static/minimal). Reviewers: eugenis, alekseyshl, vitalybuka Reviewed By: vitalybuka Subscribers: srhines, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48553 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335981 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29[cfi] Reset i-cache after copying code in test.Evgeniy Stepanov
Fixes intermittent crashes on Android. Also add PROT_READ to the code mapping for no real reason. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335943 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[asan] Change 3 tests from XFAIL to UNSUPPORTED.Evgeniy Stepanov
The failure in https://github.com/google/sanitizers/issues/981 is flaky. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335941 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[asan] Disable 3 tests on Android O+.Evgeniy Stepanov
https://github.com/google/sanitizers/issues/981 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335937 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[asan] Fix one more test on Android.Evgeniy Stepanov
This change makes it pass both on libstdc++ and libc++-based toolchains. The error was: error: function-like macro '__GLIBC_PREREQ' is not defined ^ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335936 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[asan] un-XFAIL one testEvgeniy Stepanov
NDK r16 provides glob.h, which makes this test pass. Supporting different test outcomes depending on the version of NDK add unnecessary complexity to the test harness. IMHO, it's OK to require the latest stable release. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335935 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[fuzzer] Don't run tests on Android.Evgeniy Stepanov
Need better build system support. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335933 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[TSan] More detailed error message on failed sahdow memory madviseAlex Shlyapnikov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335928 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[UBsan] minimal unit tests removing OpenBSD spacial caseDavid Carlier
The OpenBSD driver now handles sanitisers with ld.lld automatically. Reviewers: vitalybuka Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D48740 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335923 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[Darwin] Add an integration test for PGO + symbol exportsVedant Kumar
rdar://41470205 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335891 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28Skip building TSan on platforms where there are no 64-bit architectures.Kuba Mracek
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335873 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28Correct the test modified in rL335777.Haojian Wu
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335865 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28Support for multiarch runtimes layoutPetr Hosek
This change adds a support for multiarch style runtimes layout, so in addition to the existing layout where runtimes get installed to: lib/clang/$version/lib/$os Clang now allows runtimes to be installed to: lib/clang/$version/$target/lib This also includes libc++, libc++abi and libunwind; today those are assumed to be in Clang library directory built for host, with the new layout it is possible to install libc++, libc++abi and libunwind into the runtime directory built for different targets. The use of new layout is enabled by setting the LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both projects and runtimes layouts. The runtimes CMake build has been further modified to use the new layout when building runtimes for multiple targets. Differential Revision: https://reviews.llvm.org/D45604 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335809 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-28[libFuzzer] [Tests] [NFC] Change seed for reduce_inputs.testGeorge Karpenkov
Differential Revision: https://reviews.llvm.org/D48686 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335802 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[libFuzzer] [NFC] [Tests] Mark signal handling tests as UNSUPPORTED on DarwinGeorge Karpenkov
Under load, these tests tend to fail sporadically on our bots. In my understanding, the signal handling is not guaranteed to happen within 2 seconds, and the test is inherently flaky. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335792 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[sanitizer] zx_cprng_draw no longer returns any valuePetr Hosek
Remove the return value check. Differential Revision: https://reviews.llvm.org/D48671 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335790 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27Another shot at fixing android r335644 failureVlad Tsyrklevich
The android buildbot moves the build outputs to a different directory and rewrites the executable path, the DSO passed as an argument does not get re-written. Use rpaths to load the DSO the same way the test/cfi/cross-dso/ tests do and test the DSO name differently. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335777 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[UBSan] Add silence_unsigned_overflow flag.Matt Morehouse
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335762 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[sanitizer] zx_cprng_draw no longer takes the output argumentPetr Hosek
The zx_cprng_draw system call no longer takes the output argument. Differential Revision: https://reviews.llvm.org/D48657 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335755 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[asan] Relax the null_deref.cc test even furtherVedant Kumar
On Darwin/x86_64, asan may report the crashing line of NullDeref as line 19 (i.e the closing brace of the function), whereas on other targets we see line 15 ("ptr[10]++"). The optimized debug info here isn't reliable enough to check. rdar://problem/41526369 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335747 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[asan] Relax a test which depends on optimized debug infoVedant Kumar
On some ARM platforms this test depends on debug locations being present on constant materialization code, which was eliminated in r335497. Relax the test to allow two outcomes: the backtrace either contains the right line numbers, or no line numbers. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335741 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27[CMake] Tidy up the organisation of compiler-rt when configured as a standaloneDan Liew
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335728 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27Fix another bot broken by r335644Vlad Tsyrklevich
The android sanitizer bot can't resolve the function name in the DSO and it's not relevant to the test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335693 91177308-0d34-0410-b5e6-96231b3b80d8