summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/asan
Commit message (Collapse)AuthorAgeFilesLines
...
* [asan] Add Windows test for handle_segv and SetUnhandledExceptionFilterReid Kleckner2018-06-201-0/+35
| | | | llvm-svn: 335087
* [asan] Enable fgets_fputs test on AndroidVitaly Buka2018-06-161-5/+2
| | | | | | | | | "echo data" didn't work because %run on android executes test on the device when lit shell command on the host system. https://github.com/google/sanitizers/issues/952 llvm-svn: 334883
* [asan] Move long-object-path.cc test to LinuxVitaly Buka2018-06-151-1/+0
| | | | | | | | | | | | Reviewers: Lekensteyn Reviewed By: Lekensteyn Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D48186 llvm-svn: 334866
* [ASAN] fix typos and disable long-object-path test for win32Peter Wu2018-06-141-0/+1
| | | | | | | | 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
* [ASAN] fix startup crash in dlsym for long paths since glibc 2.27Peter Wu2018-06-141-0/+7
| | | | | | | | | | | | | | | | | | | | Summary: Error messages for dlsym used to be stored on the stack, but since commit 2449ae7b ("ld.so: Introduce struct dl_exception") in glibc 2.27 these are now stored on the heap (and thus use the dlsym alloc pool). Messages look like "undefined symbol: __isoc99_printf\0/path/to/a.out". With many missing library functions and long object paths, the pool is quickly exhausted. Implement a simple mechanism to return freed memory to the pool (clear it in case it is used for calloc). Fixes https://github.com/google/sanitizers/issues/957 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D47995 llvm-svn: 334703
* [ASAN] Re-enable fgets_fputs test for darwin.Ahmed Bougacha2018-06-131-1/+1
| | | | | | It seems to be passing, at least on the bots I've seen. llvm-svn: 334626
* [ASAN] disable fgets_fputs test for android and darwinPeter Wu2018-06-121-0/+1
| | | | | | | | aarch64/aosp_marlin-userdebug/OPR4.170623.016] builder unexpectedly failed the fgets test (`assertion "fp" failed`). macOS unexpectedly passes the fputs test without triggering ASAN. llvm-svn: 334558
* [ASAN] fix fgets and fgets_fputs tests failurePeter Wu2018-06-121-15/+25
| | | | | | Some systems (Android) might not have /etc/passwd. Fixes r334450. llvm-svn: 334487
* [sanitizer] Add fgets, fputs and puts into sanitizer_commonPeter Wu2018-06-111-0/+46
| | | | | | | | | | | | | | | Summary: Add fgets, fputs and puts to sanitizer_common. This adds ASAN coverage for these functions, extends MSAN support from fgets to fputs/puts and extends TSAN support from puts to fputs. Fixes: https://github.com/google/sanitizers/issues/952 Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D46545 llvm-svn: 334450
* [Sanitizers] Move allocator_returns_null.cc test to common.Alex Shlyapnikov2018-06-111-133/+0
| | | | | | | | | | | | | | | | Summary: Add allocator_returns_null.cc test to sanitizer_common and remove all sanitizer-specific ones except: - HWASan is not covered by sanitizer_common - TSan allocator does not have comprehensive error reporting yet Reviewers: vitalybuka Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D47971 llvm-svn: 334433
* [Sanitizers] Move pvalloc overflow tests to common.Alex Shlyapnikov2018-06-111-46/+0
| | | | | | | | | | | | | | | | | | | Summary: Now all sanitizers with improved allocator error reporting are covered by these common tests. Also, add pvalloc-specific checks to LSan. HWASan is not covered by sanitizer_common, hence its own pvalloc and other allocator tests. Reviewers: vitalybuka Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D47970 llvm-svn: 334424
* [asan] Re-enable no_asan_gen_globals for 32-bitVitaly Buka2018-06-081-2/+0
| | | | | | PR22682. Bug in gold was fixed 3 years ago. llvm-svn: 334319
* [Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalignAlex Shlyapnikov2018-06-082-47/+0
| | | | | | | | | | | | | | | Summary: Move the corresponding tests to the common folder (as all of the sanitizer allocators will support this feature soon) and add the checks specific to aligned_alloc to ASan and LSan allocators. Reviewers: vitalybuka Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D47924 llvm-svn: 334316
* [ASAN] Sanitize testsuite for ARM.Yvan Roux2018-06-0114-19/+13
| | | | | | | | | | | | | Address failures exhibited by ARMv8 bot in Thumb mode: - Fix logic for fast unwinding support (i.e feature is not available for Thumb) - Fix Unsupported and Requires rules to handle armv8 as well as soft and hard float targets - Un-xfail passing tests Differential Revision: https://reviews.llvm.org/D47575 llvm-svn: 333729
* Do not link with -ldl in NetBSD/ASan testsKamil Rytarowski2018-05-191-2/+1
| | | | | | | | | | | | | | | | | | | Summary: The dlopen(3) features on NetBSD are in libc. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, kcc Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D46713 llvm-svn: 332790
* Fix another case where libstdc++ is being inappropriately requested (seeDan Liew2018-05-142-48/+1
| | | | | | | | | | | | | | | | | | | r328775) for all platforms. Given that this is the second occurance of this problem it seemed worth fixing this problem in a more generic way. r328775 has been reverted and now a substitution `%linux_static_libstdcplusplus` has been provided. This substitution expands to Clang driver arguments to use a static libstdc++ on Linux and on all other platforms it expands to nothing. The `asan/TestCases/throw_invoke_test.cc` and `test/tsan/static_init6.cc` test cases now use this substitution. rdar://problem/39948818 Differential Revision: https://reviews.llvm.org/D46401 llvm-svn: 332254
* [asan] Align __asan_global_start so that it works with LLDReid Kleckner2018-04-261-0/+18
| | | | | | | | | | | Otherwise LLD will not align the .ASAN$GA section start, and &__asan_globals + 1 will not be the start of the next real ASan global metadata in .ASAN$GL. We discovered this issue when attempting to use LLD on Windows in Chromium: https://crbug.com/837090 llvm-svn: 330990
* asan: Mark printf-4.c as unsupported on Windows.Peter Collingbourne2018-04-201-2/+3
| | | | | | | | | Although sprintf is not intercepted on Windows, this test can pass if sprintf calls memmove, which is intercepted, so we can't XFAIL it. Differential Revision: https://reviews.llvm.org/D45894 llvm-svn: 330469
* [asan] Reduce flakiness in stack-overflow detectionKuba Mracek2018-04-131-1/+1
| | | | | | | | IsStackOverflow only treats accesses within 512 bytes of SP as stack-overflow. This should really be the size of a page instead. The scariness_score_test.cc triggers stack overflow with frames that are even larger than a page, which can also trigger a fault that will not be recognized as stack-overflow. Let's just use smaller frames. llvm-svn: 329980
* [compiler-rt][asan][mips] UnXFAIL some consistently passing testsSimon Dardis2018-04-102-8/+0
| | | | llvm-svn: 329688
* [asan] Fix aligned_alloc test caseKostya Kortchinsky2018-04-041-3/+2
| | | | | | | | | | | | | | | | | | | | | Summary: Under some circumstances (that I haven't dug further into), the first stack frame for the test looks like: `#0 0x4e6038 in __interceptor_memalign.localalias.1 ...compiler-rt/lib/asan/asan_malloc_linux.cc:113` which isn't matched by the current CHECK. Expand the CHECK to match aligned_alloc or memalign. Hopefully this should fix the PowerPC issue as well, otherwise we'll bring back the FIXME. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D45281 llvm-svn: 329226
* [ASan] Disable new ASan error reporting tests on various ARMs.Alex Shlyapnikov2018-03-305-0/+10
| | | | | | | | | As many other ASan tests already, has to disable these failing tests on arm, armhf and aarch64 configs. Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328849
* [asan] Split the `throw_invoke_test.cc` into a Linux specific variantDan Liew2018-03-292-1/+48
| | | | | | | | | | | | and the general version to avoid use of libstdc++ on non-Linux platforms. This is motivated by the fact that using `libstdc++` is deprecated on Darwin and maybe removed some day. Differential Revision: https://reviews.llvm.org/D44733 llvm-svn: 328775
* [ASan] Disable aligned_alloc-alignment.cc on PPC64.Alex Shlyapnikov2018-03-291-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328753
* [ASan] Disable aligned_alloc-alignment.cc on ppc64beAlex Shlyapnikov2018-03-291-4/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328742
* [ASan] Disable aligned_alloc-alignment.cc test on gcc.Alex Shlyapnikov2018-03-281-0/+3
| | | | | | | | | This check "CHECK: {{#0 0x.* in .*aligned_alloc}}" fails on ppc64be, gcc build. Disabling the test for gcc for now. Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328741
* [ASan] Disable aligned_alloc-alignment.cc on Android.Alex Shlyapnikov2018-03-281-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328734
* [ASan] Add aligned_alloc declaration to aligned_alloc-alignment.cc test.Alex Shlyapnikov2018-03-281-0/+2
| | | | | | | | aligned_alloc is not always defined in headers. Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328726
* [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-03-288-11/+100
| | | | | | | | | | | | | | | | | | Summary: Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, not stack, no details, not too helpful nor informative. To improve the situation, ASan detailed errors were defined and reported under the appropriate conditions. Issue: https://github.com/google/sanitizers/issues/887 Reviewers: eugenis Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44404 llvm-svn: 328722
* Revert "[asan] Replace vfork with fork."Evgeniy Stepanov2018-03-271-30/+0
| | | | | | | | | Replacing vfork with fork results in significant slowdown of certain apps (in particular, memcached). This reverts r327752. llvm-svn: 328600
* [asan] Replace vfork with fork.Evgeniy Stepanov2018-03-161-0/+30
| | | | | | | | | | | | | | | | | | | | Summary: vfork is not ASan-friendly because it modifies stack shadow in the parent process address space. While it is possible to compensate for that with, for example, __asan_handle_no_return before each call to _exit or execve and friends, simply replacing vfork with fork looks like by far the easiest solution. Posix compliant programs can not detect the difference between vfork and fork. Fixes https://github.com/google/sanitizers/issues/925 Reviewers: kcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44587 llvm-svn: 327752
* [asan] poison_heap=0 should not disable __asan_handle_no_return.Evgeniy Stepanov2018-03-121-0/+13
| | | | | | | | | | Reviewers: kcc, alekseyshl, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44339 llvm-svn: 327337
* [asan] Clean up the REQUIRES of `asan/TestCases/strcat-overlap.cc`Dan Liew2018-03-091-1/+5
| | | | | | | | | | | | by explicitly listing where we expect this test to work. Because this test invokes undefined behaviour all sorts of things can happen (e.g. crash, or on some bots asan manages to catch something). The test seems to pass okay on Darwin (x86_64/x86_64/i386) and on Linux (x86_64/i386) so explicitly require one of these platforms to run the test. llvm-svn: 327185
* [asan] Try to unbreak arm build bots by only running the test onDan Liew2018-03-091-0/+1
| | | | | | | x86_64 and x86_64H (and not in the iOS simulator) where it seems to work. We need to properly fix the test when time permits. llvm-svn: 327122
* Mark the -overlap tests are "UNSUPPORTED: android". Android test harness ↵Kuba Mracek2018-03-094-0/+7
| | | | | | doesn't know how to handle suppression files. llvm-svn: 327091
* Mark strcat-overlap.cc as "UNSUPPORTED: win32"Kuba Mracek2018-03-091-0/+2
| | | | llvm-svn: 327081
* Move lto-constmerge-odr.cc to Posix (it's failing on Windows).Kuba Mracek2018-03-081-0/+0
| | | | llvm-svn: 327080
* [asan] Fix bug where suppression of overlapping accesses was ignored onDan Liew2018-03-084-0/+184
| | | | | | | | | | `strcpy()`, `strncpy()`, `strcat()`, and `strncat()`. rdar://problem/35576899 Differential Revision: https://reviews.llvm.org/D43702 llvm-svn: 327068
* [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass ↵Kuba Mracek2018-03-082-9/+17
| | | | | | | | | | [compiler-rt part, take 3] This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. See the included testcase for an example. Differential Revision: https://reviews.llvm.org/D43959 llvm-svn: 327062
* More revert of r327031Kuba Mracek2018-03-081-0/+0
| | | | llvm-svn: 327038
* Revert r327031Kuba Mracek2018-03-082-17/+9
| | | | llvm-svn: 327032
* [asan] Fix a false positive ODR violation due to LTO ConstantMerge pass ↵Kuba Mracek2018-03-082-9/+17
| | | | | | | | | | [compiler-rt part] This fixes a false positive ODR violation that is reported by ASan when using LTO. In cases, where two constant globals have the same value, LTO will merge them, which breaks ASan's ODR detection. Differential Revision: https://reviews.llvm.org/D43959 llvm-svn: 327031
* [asan] Intercept std::rethrow_exception indirectlyVitaly Buka2018-02-261-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [asan] Add "arm64" into the list of 64-bit architecturesKuba Mracek2018-02-151-3/+3
| | | | | | | | It looks like get_bits_for_arch doesn't recognize "arm64" as a 64-bit architecture, and it actually matches the "arm" regexp, which marks it as 32-bit. Let's fix that by matching the 64-bit list first and addin "arm64" into the list. Differential Revision: https://reviews.llvm.org/D43155 llvm-svn: 325300
* Enable test/asan for NetBSDKamil Rytarowski2018-02-151-1/+1
| | | | | | Sponsored by <The NetBSD Foundation> llvm-svn: 325246
* Use NULL instead of nullptr in invalid-pointer-pairs-compare-null.cc; ↵Kuba Mracek2018-02-021-8/+8
| | | | | | nullptr is not available on older Darwin systems. llvm-svn: 324136
* [asan] Make concurrent_overflow.cc less flakyKuba Mracek2018-02-021-3/+4
| | | | | | | | The "sleep(5)" sometimes times out on our bots, causing the test to fail. Let's use pthread_join. Differential Revision: https://reviews.llvm.org/D42862 llvm-svn: 324126
* Make detect_invalid_pointer_pairs option to be tristate.Alex Shlyapnikov2018-02-016-6/+48
| | | | | | | | | | | | | | | | Summary: With the change, one can choose not to report comparison (or subtraction) of a pointer with nullptr pointer. Reviewers: kcc, jakubjelinek, alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D41479 llvm-svn: 323995
* [PowerPC][asan] Fix asan tests to handle changed memory layoutsBill Seurer2018-01-231-5/+13
| | | | | | | | | | 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 fixes up a test case that was found to fail on some newer Fedora releases that use different address ranges. ref: https://reviews.llvm.org/D40907 llvm-svn: 323217
* Small fixes for detect_invalid_pointer_pairs.Alex Shlyapnikov2018-01-222-1/+5
| | | | | | | | | | | | | | | | | Summary: One test-case uses a wrong operation (should be subtraction). Second test-case should declare a global variables before a tested one in order to guarantee we will find a red-zone. Reviewers: kcc, jakubjelinek, alekseyshl Reviewed By: alekseyshl Subscribers: kubamracek Differential Revision: https://reviews.llvm.org/D41481 llvm-svn: 323162
OpenPOWER on IntegriCloud