summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2017-11-09[libFuzzer] mechanically simplify a test, NFCKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317756 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[libFuzzer] fix a test (and hopefully, the bot)Kostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317749 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09[libFuzzer] allow user to specify the merge control fileKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317747 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Correct atexit(3) support in TSan/NetBSDKamil Rytarowski
Summary: The NetBSD specific implementation of cxa_atexit() does not preserve the 2nd argument if dso is equal to NULL. Changes: - Split paths of handling intercepted __cxa_atexit() and atexit(3). This affects all supported Operating Systems. - Add a local stack-like structure to hold the __cxa_atexit() context. atexit(3) is documented in the C standard as calling callback from the earliest to the oldest entry. This path also fixes potential ABI problem of passing an argument to a function from the atexit(3) callback mechanism. - Add new test to ensure LIFO style of atexit(3) callbacks: atexit3.cc Proposal to change the behavior of __cxa_atexit() in NetBSD has been rejected. With the above changes TSan/NetBSD with the current tsan_interceptors.cc can bootstrap into operation. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, dvyukov, joerg, kcc, eugenis Reviewed By: dvyukov Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39619 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317735 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08[ThinLTO] New test needs to require LTOTeresa Johnson
Fix buildbot failures: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/5262/steps/annotate/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317728 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08[ThinLTO] Ensure sanitizer passes are runTeresa Johnson
Recommit new test as linux-only. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317723 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08Revert "[ThinLTO] Ensure sanitizer passes are run"Teresa Johnson
This reverts commit r317715. It failed a Windows buildbot since ThinLTO is presumably not supported, leading to a corrupt file error on the object file: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/19395/steps/run%20check-asan/logs/stdio Will re-commit the new ThinLTO part of the test to a linux only test file. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317717 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-08[ThinLTO] Ensure sanitizer passes are runTeresa Johnson
Summary: Test fix to pass manager for ThinLTO. Depends on D39565. Reviewers: pcc Subscribers: kubamracek, mehdi_amini, llvm-commits, inglorion Differential Revision: https://reviews.llvm.org/D39566 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317715 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01[fuzzer] Script to detect unbalanced allocation in -trace_malloc outputVitaly Buka
Reviewers: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39466 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317119 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01[scudo] Fix standlone build -lrt requirementKostya Kortchinsky
Summary: The split in D39461 introduced separate C++ flags, but `cxx_flags` needs `-lrt` as well for the standalone build. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39497 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317103 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01[scudo] Implement stricter separation of C vs C++Kostya Kortchinsky
Summary: Initially, Scudo had a monolithic design where both C and C++ functions were living in the same library. This was not necessarily ideal, and with the work on -fsanitize=scudo, it became more apparent that this needed to change. We are splitting the new/delete interceptor in their own C++ library. This allows more flexibility, notably with regard to std::bad_alloc when the work is done. This also allows us to not link new & delete when using pure C. Additionally, we add the UBSan runtimes with Scudo, in order to be able to have a -fsanitize=scudo,undefined in Clang (see work in D39334). The changes in this patch: - split the cxx specific code in the scudo cmake file into a new library; (remove the spurious foreach loop, that was not necessary) - add the UBSan runtimes (both C and C++); - change the test cmake file to allow for specific C & C++ tests; - make C tests pure C, rename their extension accordingly. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: srhines, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D39461 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317097 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01[fuzzer] Fix threaded stack printingVitaly Buka
Reviewers: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39397 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317071 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-01Revert "[fuzzer] Fix threaded stack printing and nested mallocs"Vitaly Buka
Fails on darwin Revert "[fuzzer] Script to detect unbalanced allocation in -trace_malloc output" Needs previous one. This reverts commit r317034, r317036. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317061 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-31[fuzzer] Script to detect unbalanced allocation in -trace_malloc outputVitaly Buka
Reviewers: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39466 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317036 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-31[fuzzer] Fix threaded stack printing and nested mallocsVitaly Buka
Summary: Nested mallocs are possible with internal symbolizer. Reviewers: kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39397 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317034 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27[LSan] Disable a couple of failing tests on PPC64 (pending investigation).Alex Shlyapnikov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316720 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-26[LSan] Enable LSan tests on PPC64 Linux.Alex Shlyapnikov
Summary: LSan is functional on PPC64 Linux now, let's enable all tests. One test required ppc specific changes: use_registers.cc. Reviewers: eugenis Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D39316 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316698 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[libFuzzer] trying to make a test more stable on MacKostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316627 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[msan] Intercept __strxfrm_l.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316613 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[sanitizer] Random shuffling of chunks for the 32-bit Primary AllocatorKostya Kortchinsky
Summary: The 64-bit primary has had random shuffling of chunks for a while, this implements it for the 32-bit primary. Scudo is currently the only user of `kRandomShuffleChunks`. This change consists of a few modifications: - move the random shuffling functions out of the 64-bit primary to `sanitizer_common.h`. Alternatively I could move them to `sanitizer_allocator.h` as they are only used in the allocator, I don't feel strongly either way; - small change in the 64-bit primary to make the `rand_state` initialization `UNLIKELY`; - addition of a `rand_state` in the 32-bit primary's `SizeClassInfo` and shuffling of chunks when populating the free list. - enabling the `random_shuffle.cpp` test on platforms using the 32-bit primary for Scudo. Some comments on why the shuffling is done that way. Initially I just implemented a `Shuffle` function in the `TransferBatch` which was simpler but I came to realize this wasn't good enough: for chunks of 10000 bytes for example, with a `CompactSizeClassMap`, a batch holds only 1 chunk, meaning shuffling the batch has no effect, while a region is usually 1MB, eg: 104 chunks of that size. So I decided to "stage" the newly gathered chunks in a temporary array that would be shuffled prior to placing the chunks in batches. The result is looping twice through n_chunks even if shuffling is not enabled, but I didn't notice any significant significant performance impact. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D39244 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316596 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[Sanitizers] ASan: detect new/delete calls with mismatched alignment.Alex Shlyapnikov
ASan allocator stores the requested alignment for new and new[] calls and on delete and delete[] verifies that alignments do match. The representable alignments are: default alignment, 8, 16, 32, 64, 128, 256 and 512 bytes. Alignments > 512 are stored as 512, hence two different alignments > 512 will pass the check (possibly masking the bug), but limited memory requirements deemed to be a resonable tradeoff for relaxed conditions. The feature is controlled by new_delete_type_mismatch flag, the same one protecting new/delete matching size check. Differential revision: https://reviews.llvm.org/D38574 Issue: https://github.com/google/sanitizers/issues/799 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316595 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25Add NetBSD improvements in sanitizersKamil Rytarowski
Summary: Changes: * Add initial msan stub support. * Handle NetBSD specific pthread_setname_np(3). * NetBSD supports __attribute__((tls_model("initial-exec"))), define it in SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE. * Add ReExec() specific bits for NetBSD. * Simplify code and add syscall64 and syscall_ptr for !NetBSD. * Correct bunch of syscall wrappers for NetBSD. * Disable test/tsan/map32bit on NetBSD as not applicable. * Port test/tsan/strerror_r to a POSIX-compliant OSes. * Disable __libc_stack_end on NetBSD. * Disable ReadNullSepFileToArray() on NetBSD. * Define struct_ElfW_Phdr_sz, detected missing symbol by msan. * Change type of __sanitizer_FILE from void to char. This helps to reuse this type as an array. Long term it will be properly implemented along with SANITIZER_HAS_STRUCT_FILE setting to 1. * Add initial NetBSD support in lib/tsan/go/buildgo.sh. * Correct referencing stdout and stderr in tsan_interceptors.cc on NetBSD. * Document NetBSD x86_64 specific virtual memory layout in tsan_platform.h. * Port tests/rtl/tsan_test_util_posix.cc to NetBSD. * Enable NetBSD tests in test/msan/lit.cfg. * Enable NetBSD tests in test/tsan/lit.cfg. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis, kcc, dvyukov Reviewed By: dvyukov Subscribers: #sanitizers, llvm-commits, kubamracek Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39124 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316591 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-25[XRay][compiler-rt][NFC] Clean up xray log files before running testDean Michael Berris
Improves the test behaviour in the face of failure. Without this change the fdr-single-thread.cc test may leave around artefacts of a previous failing run since the cleanup doesn't happen if any of the intermediary steps fail. Non-functional change. Subscribers: llvm-commits git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316548 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23[Sanitizers] New sanitizer API to purge allocator quarantine.Alex Shlyapnikov
Summary: Purging allocator quarantine and returning memory to OS might be desired between fuzzer iterations since, most likely, the quarantine is not going to catch bugs in the code under fuzz, but reducing RSS might significantly prolong the fuzzing session. Reviewers: cryptoad Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D39153 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-23[scudo] Add a shared runtimeKostya Kortchinsky
Summary: Up to now, the Scudo cmake target only provided a static library that had to be linked to an executable to benefit from the hardened allocator. This introduces a shared library as well, that can be LD_PRELOAD'ed. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: srhines, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D38980 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316342 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20tsan: add tests missed in r316209Dmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316210 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-20[tsan] Add Mutex annotation flag for constant-initialized ↵Dmitry Vyukov
__tsan_mutex_linker_init behavior Add a new flag, _⁠_tsan_mutex_not_static, which has the opposite sense of _⁠_tsan_mutex_linker_init. When the new _⁠_tsan_mutex_not_static flag is passed to _⁠_tsan_mutex_destroy, tsan ignores the destruction unless the mutex was also created with the _⁠_tsan_mutex_not_static flag. This is useful for constructors that otherwise woud set _⁠_tsan_mutex_linker_init but cannot, because they are declared constexpr. Google has a custom mutex with two constructors, a "linker initialized" constructor that relies on zero-initialization and sets ⁠_⁠_tsan_mutex_linker_init, and a normal one which sets no tsan flags. The "linker initialized" constructor is morally constexpr, but we can't declare it constexpr because of the need to call into tsan as a side effect. With this new flag, the normal c'tor can set _⁠_tsan_mutex_not_static, the "linker initialized" constructor can rely on tsan's lazy initialization, and _⁠_tsan_mutex_destroy can still handle both cases correctly. Author: Greg Falcon (gfalcon) Reviewed in: https://reviews.llvm.org/D39095 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316209 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-17Revert "[asan] Deflake one test by running it 3 times."Evgeniy Stepanov
Disable this test on Android/x86 only. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@316023 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-16[cfi] Test cross-dso CFI on Android.Evgeniy Stepanov
Reviewers: vitalybuka, pcc Subscribers: llvm-commits, srhines Differential Revision: https://reviews.llvm.org/D38911 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13[asan] Deflake one test by running it 3 times.Evgeniy Stepanov
The test seems to trigger an android platform bug under load. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315777 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13[cfi] Use %ld_flags_rpath_* substitutions in tests (NFC)Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315775 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13LowerTypeTests: Give imported symbols a type with size 0 so that they are ↵Peter Collingbourne
not assumed not to alias. It is possible for both a base and a derived class to be satisfied with a unique vtable. If a program contains casts of the same pointer to both of those types, the CFI checks will be lowered to this (with ThinLTO): if (p != &__typeid_base_global_addr) trap(); if (p != &__typeid_derived_global_addr) trap(); The optimizer may then use the first condition combined with the assumption that __typeid_base_global_addr and __typeid_derived_global_addr may not alias to optimize away the second comparison, resulting in an unconditional trap. This patch fixes the bug by giving imported globals the type [0 x i8]*, which prevents the optimizer from assuming that they do not alias. Differential Revision: https://reviews.llvm.org/D38873 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315753 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13[libFuzzer] tweam use_feature_frequency to be less aggressive; run a dummy ↵Kostya Serebryany
input before the seed corpus git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315657 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12[sanitizer] Workaround a Linux kernel bug in hard_rss_limit_mb_test.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315632 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12[asan] Disable a flaky test on android.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315602 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11Disable TSan tests on Android.Evgeniy Stepanov
They never passed. This change excludes them from 'check-all'. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315512 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11Disable profile tests on Android.Evgeniy Stepanov
They never actually worked, but this way they are not included in "check-all". git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315511 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[ubsan] Support ubsan-minimal tests on Android.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315507 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[asan] Tweak test output to diagnose buildbot failures.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315479 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-11[sanitizer] Re-disable several tests on Android.Evgeniy Stepanov
The tests have been enabled by accident in r315389. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315396 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10Factor out "stable-runtime" feature and enable it on all android.Evgeniy Stepanov
This is a very poorly named feature. I think originally it meant to cover linux only, but the use of it in msan seems to be about any aarch64 platform. Anyway, this change should be NFC on everything except Android. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315389 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10XFAIL ubsan/TestCases/TypeCheck/Function/function.cpp on WindowsHans Wennborg
I think it got accidentally enabled in r315105 or thereabouts. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315374 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[ubsan] Fix Asan internal alloc corruption in PR33221 test.Evgeniy Stepanov
MAP_FIXED discards the existing mapping at the given address. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[ubsan] Disable one test on Android.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315220 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-07cmake: Fix one more usage of append()Vedant Kumar
append() isn't available with some cmake versions, so I need to use a different construct. I missed this case in r315144. http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/39355 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315157 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-07[ubsan] Add a static runtime on DarwinVedant Kumar
As a follow-up to r315142, this makes it possible to use ubsan with a static runtime on Darwin. I've also added a new StandaloneStatic testing configuration so the new setup can be tested. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315143 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06Factor out default_(a|ub)sanitizer_opts in lit.Evgeniy Stepanov
Reviewers: vitalybuka Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D38644 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315106 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[sanitizer] Test ubsan and cfi on android.Evgeniy Stepanov
Summary: Enable check-cfi and check-ubsan on Android. Check-ubsan includes standalone and ubsan+asan, but not tsan or msan. Cross-dso cfi tests are disabled for now. Reviewers: vitalybuka, pcc Subscribers: srhines, kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D38608 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[asan] Use gold linker in android tests.Evgeniy Stepanov
Replace a partial workaround for ld.bfd strangeness with the ultimate one: -fuse-ld=gold. Reason: ld.bfd problem gets worse with libc++-based NDK toolchain. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315039 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-05[libFuzzer] Disable experimental clang coverage support by default.Max Moroz
Summary: It can be enabled via "-use_clang_coverage=1" flag. Reason for disabling: libFuzzer resets Clang Counters and makes it impossible to generate coverage report for a regular fuzz target (i.e. not standalone build). Reviewers: kcc Reviewed By: kcc Subscribers: kcc Differential Revision: https://reviews.llvm.org/D38604 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315029 91177308-0d34-0410-b5e6-96231b3b80d8