summaryrefslogtreecommitdiff
path: root/test/asan
AgeCommit message (Collapse)Author
2017-12-10Update another sanitizer test for C++14.Ahmed Bougacha
Follow-up to r320251. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320284 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-09Update sanitizer tests for C++14 default in ClangTim Northover
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320251 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-07[PowerPC][asan] Update asan to handle changed memory layouts in newer kernelsBill Seurer
In more recent Linux kernels with 47 bit VMAs the layout of virtual memory for powerpc64 changed causing the address sanitizer to not work properly. This patch adds support for 47 bit VMA kernels for powerpc64 and fixes up test cases. https://reviews.llvm.org/D40908 There is an associated patch for trunk. Tested on several 4.x and 3.x kernel releases. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[ASan] Disable invalid-pointer-pairs-threads.cc on Darwin.Alex Shlyapnikov
pthread barriers are not available on OS X Differential revision: https://reviews.llvm.org/D40600 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319681 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[ASan] Fix test/asan/TestCases/Posix/invalid-pointer-pairs-threads.ccAlex Shlyapnikov
Explicitly add pthread for asan-dynamic config. Differential revision: https://reviews.llvm.org/D40600 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319671 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-04[ASan] Enhance libsanitizer support for invalid-pointer-pair.Alex Shlyapnikov
Following patch adds support of all memory origins in CheckForInvalidPointerPair function. For small difference of pointers, it's directly done in shadow memory (the limit was set to 2048B). Then we search for origin of first pointer and verify that the second one has the same origin. If so, we verify that it points either to a same variable (in case of stack memory or a global variable), or to a same heap segment. Committing on behanf of marxin and jakubjelinek. Reviewers: alekseyshl, kcc Subscribers: llvm-commits Differential revision: https://reviews.llvm.org/D40600 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[ubsan] Re-commit: lit changes for lld testing, future lto testing.Roman Lebedev
Summary: As discussed in https://github.com/google/oss-fuzz/issues/933, it would be really awesome to be able to use ThinLTO for fuzzing. However, as @kcc has pointed out, it is currently undefined (untested) whether the sanitizers actually function properly with LLD and/or LTO. This patch is inspired by the cfi test, which already do test with LTO (and/or LLD), since LTO is required for CFI to function. I started with UBSan, because it's cmakelists / lit.* files appeared to be the cleanest. This patch adds the infrastructure to easily add LLD and/or LTO sub-variants of the existing lit test configurations. Also, this patch adds the LLD flavor, that explicitly does use LLD to link. The check-ubsan does pass on my machine. And to minimize the [initial] potential buildbot breakage i have put some restrictions on this flavour. Please review carefully, i have not worked with lit/sanitizer tests before. The original attempt, r319525 was reverted in r319526 due to the failures in compiler-rt standalone builds. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc Differential Revision: https://reviews.llvm.org/D39508 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01Add missing signal.h header:Ismail Donmez
/havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:158:20: error: variable has incomplete type 'struct sigaction' struct sigaction act = {}; ^ /havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:158:10: note: forward declaration of 'sigaction' struct sigaction act = {}; ^ /havana/work/llvm/projects/compiler-rt/test/asan/TestCases/Linux/swapcontext_annotation.cc:160:17: error: use of undeclared identifier 'SIGPROF' if (sigaction(SIGPROF, &act, 0)) { ^ 2 errors generated. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319532 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01Revert "[ubsan] lit changes for lld testing, future lto testing."Roman Lebedev
This reverts commit r319525. This change has introduced a problem with the Lit tests build for compiler-rt using Gold: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/6047/steps/test%20standalone%20compiler-rt/logs/stdio llvm-lit: /b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py:101: fatal: unable to parse config file '/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg', traceback: Traceback (most recent call last): File "/b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py", line 88, in load_from_path exec(compile(data, path, 'exec'), cfg_globals, None) File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 37, in <module> if root.host_os not in ['Linux'] or not is_gold_linker_available(): File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 27, in is_gold_linker_available stderr = subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 390, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319529 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[ubsan] lit changes for lld testing, future lto testing.Roman Lebedev
Summary: As discussed in https://github.com/google/oss-fuzz/issues/933, it would be really awesome to be able to use ThinLTO for fuzzing. However, as @kcc has pointed out, it is currently undefined (untested) whether the sanitizers actually function properly with LLD and/or LTO. This patch is inspired by the cfi test, which already do test with LTO (and/or LLD), since LTO is required for CFI to function. I started with UBSan, because it's cmakelists / lit.* files appeared to be the cleanest. This patch adds the infrastructure to easily add LLD and/or LTO sub-variants of the existing lit test configurations. Also, this patch adds the LLD flavor, that explicitly does use LLD to link. The check-ubsan does pass on my machine. And to minimize the [initial] potential buildbot breakage i have put some restrictions on this flavour. Please review carefully, i have not worked with lit/sanitizer tests before. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc Differential Revision: https://reviews.llvm.org/D39508 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319525 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[sanitizer] Add 'strip_env' flag to enable/disable removing sanitizer dylib ↵Kuba Mracek
from DYLD_INSERT_LIBRARIES On macOS, we usually don't require launching the target with DYLD_INSERT_LIBRARIES anymore. However, it is still necessary when running a target that is not instrumented (and e.g. dlopen's an instrument library later). In any case, ASan and TSan currently remove themselves from the DYLD_INSERT_LIBRARIES environment variable to avoid passing it onto children. This works well e.g. when instrumenting a shell. A problem arises when the target is a non-instrumented shim (e.g. "xcrun") that either re-execs or launches a child that is supposed to get DYLD_INSERT_LIBRARIES propagated. To support this mode, this patch introduces 'strip_env' flag that can be used to keep DYLD_INSERT_LIBRARIES untouched. Differential Revision: https://reviews.llvm.org/D39991 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[asan] Don't crash on fclose(NULL)Kuba Mracek
It's explicitly forbidden to call fclose with NULL, but at least on Darwin, this succeeds and doesn't segfault. To maintain binary compatibility, ASan should survice fclose(NULL) as well. Differential Revision: https://reviews.llvm.org/D40053 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319347 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-29[asan] Allow getpwnam(NULL) for binary compatibilityKuba Mracek
Calling getpwnam(NULL) is probably a bug, but at least on Darwin, such a call succeeds without segfaulting. I have some existing code that relies on that. To maintain binary compatibility, ASan should also survive a call to getpwnam with NULL. Differential Revision: https://reviews.llvm.org/D40052 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319344 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17Enable PDB generation with lld in asan and cfi tests on Windows.Peter Collingbourne
PDB emission now works well enough that we can rely on it for these tests to pass. Differential Revision: https://reviews.llvm.org/D40188 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318546 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16[asan] Properly mark or disable tests that only work with shadow scale of 3Walter Lee
Differential Revision: https://reviews.llvm.org/D39774 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318471 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-16[asan] Port tests to shadow scale of 5Walter Lee
The tests are ported as follows: contiguous_container_crash.cc use-after-delete.cc use-after-free.cc Replace hardwired shadow granularity in CHECK statements with regex. max_redzone.cc Bump max_redzone parameter to 32. memset_test.cc Bump size parameter of __asan_poison_memory_region to 32. scariness_score_test.cc For "far-from-bounds" heap overflow, make sure overflow is more than one shadow granularity away. At large shadow granularity, there is not enough redzone between stack elements to detect far-from-bounds, so fake out that test. Differential Revision: https://reviews.llvm.org/D39773 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318470 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-09Revert new ThinLTO ASAN test until lit support addedTeresa Johnson
This reverts commit r317723 and r317728. Will be re-added when support for LTO/ThinLTO added to test/asan/lit.cfg. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317823 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-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-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-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-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-05[sanitizer] Move %ld_flags_rpath_exe to common and use it in more tests.Evgeniy Stepanov
Reviewers: vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D38527 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315010 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27ASan allocates a global data initialization array at the tail end of eachDmitry Mikulin
compunit's .data section. This vector is not poisoned. Because of this the first symbol of the following section has no left red zone. As a result, ASan cannot detect underflow for such symbols. Poison ASan allocated metadata, it should not be accessible to user code. This fix does not eliminate the problem with missing left red zones but it reduces the set of vulnerable symbols from first symbols in each input data section to first symbols in the output section of the binary. Differential Revision: https://reviews.llvm.org/D38056 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314365 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-26[mips][asan] Fix preinstalled_signal.cc test for mipsSimon Dardis
Linux for mips has a non-standard layout for the kernel sigaction struct. Adjust the layout by the minimally amount to get the test to pass, as we don't require the usage of the restorer function. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314200 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[asan/lsan] Trying to fix PPC64 and x380x buildbots after r313966Maxim Ostapenko
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313974 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[asan/lsan] Trying to fix buildbots after r313966Maxim Ostapenko
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313967 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-22[asan/lsan] Make LSan compliant with recovery mode when running on top of ASanMaxim Ostapenko
Don't overwrite exit code in LSan when running on top of ASan in recovery mode to avoid breakage of users code due to found leaks. Patch by Slava Barinov. Differential Revision: https://reviews.llvm.org/D38026 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313966 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[asan] Remove trailing spacesVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313845 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[asan] Remove "COLLISION" workaround for datarace in asanVitaly Buka
"nested bug in the same thread" is not expected in case like this and was caused by https://github.com/google/sanitizers/issues/858 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313844 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-21[asan] Remove "rm -f" in tests where it was needed only because of >>Vitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20[asan] Fix nested error detectionVitaly Buka
Summary: Fixes https://github.com/google/sanitizers/issues/858 Reviewers: eugenis, dvyukov Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D38019 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313835 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20[asan] Try to fix windows test by fflush(stderr)Vitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313728 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-20[asan] Resolve FIXME by converting gtest into lit testVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313727 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-18[ubsan] Fix interface_symbols_windows testVitaly Buka
Summary: 1. Update ubsan_interface.inc to make the test happy. 2. Switch interface_symbols_linux and interface_symbols_darwin to C++ to import __ubsan_handle_dynamic_type_cache_miss 3. Switch interface_symbols_windows to C++ for consistency. Reviewers: rnk, zturner Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37986 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313551 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-17Mark various failing tests with "UNSUPPORTED: ios".Kuba Mracek
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313498 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16[sanitizer] Support check-asan on AndroidVitaly Buka
This patch enabled asan tests from sanitizer_common. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313444 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16[sanitizer] Move android_commoands from asan into sanitizer_commonVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313443 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16[asan] Remove not-androidVitaly Buka
Replaced with !android git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-16[asan] Enable asan_and_llvm_coverage_test.cc on AndroidVitaly Buka
Test just needs profile. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-14[asan] Disable two dynamic tests on armhfVitaly Buka
This is not an regression. Tests are old and we just recently started to run them on bots with dynamic runtime. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313283 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-13[compiler-rt] Move dump_instruction_bytes and dump_registers into ↵Vitaly Buka
sanitizer_common Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37766 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-11[asan] Include asan-dynamic into check-allVitaly Buka
Summary: It's adds just 1k to about 45k tests. Reviewers: eugenis, alekseyshl Subscribers: kubamracek, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D37666 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312937 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-09[asan] Fix tests broken by r312858Vitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-09[compiler-rt] Move allow_user_segv.cc into sanitizer_commonVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D37537 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-09[asan] Use more generic string in error messageVitaly Buka
Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D37609 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312858 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-30Finalize ASAN/NetBSDKamil Rytarowski
Summary: This revision contains various cleanups. Sponsored by <The NetBSD Foundation> Reviewers: kcc, vitalybuka, joerg, eugenis Reviewed By: kcc Subscribers: emaste, srhines, llvm-commits, kubamracek, mgorny, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D37244 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@312188 91177308-0d34-0410-b5e6-96231b3b80d8