summaryrefslogtreecommitdiff
path: root/lib/asan/tests
AgeCommit message (Collapse)Author
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-13[asan] Add CMake hook to override shadow scale in compiler_rtWalter Lee
Allow user to override shadow scale in compiler_rt by passing -DCOMPILER_RT_ASAN_SHADOW_SCALE=n to CMake. Propagate the override shadow scale value via a compiler define to compiler-rt and asan tests. Tests will use the define to partially disable unsupported tests. Set "-mllvm -asan-mapping-scale=<n>" for compiler_rt tests. Differential Revision: https://reviews.llvm.org/D39469 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318038 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-12[cmake] [asan] Remove unnecessary gtest dep from dynamic testsMichal Gorny
Remove the redundant dependency on 'gtest' target from the dynamic tests in non-MSVC environment. The tests reuse compiled objects from ASAN_INST_TEST_OBJECTS, and therefore they have been built against gtest already. This both fixes the spurious dependency on 'gtest' target that breaks stand-alone builds, and brings the dynamic tests more in line with regular tests which do not pass this dependency to add_compiler_rt_test() through generate_compiler_rt_tests(). Differential Revision: https://reviews.llvm.org/D38840 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315620 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-07[asan] Disable wcslen test on 32-bit Android.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315132 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-08-29Shorten filenames of tests (-with-calls to -calls)Kamil Rytarowski
Summary: The NetBSD's 8(beta) versions of kernel functions to retrieve program name (vnode to path translator) and process memory map have internal limit of processing filenames with maximum of 31 characters. Filenames like Asan-x86_64-with-calls-Noinst-Test break this limit and affect tests. Rename "-with-calls" to "-calls". This changes fixes all issues for the Address Sanitizer test target (check-asan) on the current NetBSD support caused by long filenames. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, filcab, fjricci, kcc Reviewed By: vitalybuka Subscribers: kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D37149 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311966 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-28[asan] Move __asan_handle_no_return to public headerPetr Hosek
Heretofore asan_handle_no_return was used only by interceptors, i.e. code private to the ASan runtime. However, on systems without interceptors, code like libc++abi is built with -fsanitize=address itself and should call asan_handle_no_return directly from __cxa_throw so that no interceptor is required. Patch by Roland McGrath Differential Revision: https://reviews.llvm.org/D36811 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311869 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[sanitizers CMake] NFC Refactor the logic for compiling and generating testsGeorge Karpenkov
into a function. Most CMake configuration under compiler-rt/lib/*/tests have almost-the-same-but-not-quite functions of the form add_X_[unit]tests for compiling and running the tests. Much of the logic is duplicated with minor variations across different sub-folders. This can harm productivity for multiple reasons: For newcomers, resulting CMake files are very large, hard to understand, and hide the intention of the code. Changes for enabling certain architectures end up being unnecessarily large, as they get duplicated across multiple folders. Adding new sub-projects requires more effort than it should, as a developer has to again copy-n-paste the configuration, and it's not even clear from which sub-project it should be copy-n-pasted. With this change the logic of compile-and-generate-a-set-of-tests is extracted into a function, which hopefully makes writing and reading CMake much easier. Differential Revision: https://reviews.llvm.org/D36116 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310971 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[CMake compiler-rt] NFC: Minor CMake refactoring.George Karpenkov
Detect ObjC files in `clang_compile` and pass an appropriate flag to a compiler, also change `clang_compile` to a function. Differential Revision: https://reviews.llvm.org/D36727 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310945 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-15[compiler-rt CMake] CMake refactoring: create directories in helper func.George Karpenkov
Change macro to a function, move creating test directory into `add_compiler_rt_test`. Differential Revision: https://reviews.llvm.org/D36724 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08NetBSD compatibility nit in asan_test_utils.hKamil Rytarowski
Summary: Do not include <malloc.h> on NetBSD, as this header serves on this OS backward compatibility with K&R alias for <stdlib.h>. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, kcc, joerg, filcab, fjricci Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36469 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-07Fix asan_test.cc build on NetBSDKamil Rytarowski
Summary: Include <stdarg.h> for variable argument list macros (va_list, va_start etc). Add fallback definition of _LIBCPP_GET_C_LOCALE, this is required for GNU libstdc++ compatibility. Define new macro SANITIZER_GET_C_LOCALE. This value is currently required for FreeBSD and NetBSD for printf_l(3) tests. Sponsored by <The NetBSD Foundation> Reviewers: joerg, kcc, vitalybuka, filcab, fjricci Reviewed By: vitalybuka Subscribers: llvm-commits, emaste, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36406 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310323 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28[sanitizer tests CMake] Factor out CMake logic for compiling sanitizer testsGeorge Karpenkov
Currently there's a large amount of CMake logic duplication for compiling sanitizer tests. If we add more sanitizers, the duplication will get even worse. This change factors out common compilation commands into a macro available to all sanitizers. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309405 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-28[sanitizers] Sanitizer tests CMake clean up: try #2George Karpenkov
This patch addresses two issues: Most of the time, hacks with `if/else` in order to get support for multi-configuration builds are superfluous. The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it expands to `.` on all single-configuration builds, and to a configuration name otherwise. The `if/else` hacks for the library name generation should also not be done, as CMake has `TARGET_FILE` generator expression precisely for this purpose, as it expands to the exact filename of the resulting target. Differential Revision: https://reviews.llvm.org/D35952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309341 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27Revert "[sanitizers] Sanitizer tests CMake clean up"George Karpenkov
This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a. Fails on some bots, reverting until I can fix it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309318 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-27[sanitizers] Sanitizer tests CMake clean upGeorge Karpenkov
This patch addresses two issues: Most of the time, hacks with `if/else` in order to get support for multi-configuration builds are superfluous. The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it expands to `.` on all single-configuration builds, and to a configuration name otherwise. The `if/else` hacks for the library name generation should also not be done, as CMake has `TARGET_FILE` generator expression precisely for this purpose, as it expands to the exact filename of the resulting target. Differential Revision: https://reviews.llvm.org/D35952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309306 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-18[asan] Remove recent asan tests which expect death in allocatorVitaly Buka
These tests assume allocator_may_return_null=false If allocator_may_return_null=true, gtest would not be able to switch it. Tests needs to be re-implemented as lit tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308254 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-14[Sanitizers] ASan and LSan allocator set errno on failure.Alex Shlyapnikov
Summary: Set proper errno code on alloction failures and change some implementations to satisfy their man-specified requirements: LSan: valloc and memalign ASan: pvalloc, memalign and posix_memalign Changing both allocators in one patch since LSan depends on ASan allocator in some configurations. Reviewers: vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D35440 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@308064 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-01[asan] Add strndup/__strndup interceptors.Pierre Gousseau
Recommit of r302781 with Vitaly Buka's fix for non zero terminated strings. Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304399 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-26[asan] Enable back some ASan tests disabled on PowerPC.Alex Shlyapnikov
Summary: D33521 addressed a memory ordering issue in BlockingMutex, which seems to be the cause of a flakiness of a few ASan tests on PowerPC. Reviewers: eugenis Subscribers: kubamracek, nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D33569 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303995 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25[compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka
Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303842 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-24Revert "[compiler-rt] Change default of allow_user_segv_handler to true"Vitaly Buka
Breaks sanitizer-x86_64-linux-fuzzer bot. This reverts commit r303729. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303795 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-24[compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka
Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303729 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20Revert "[compiler-rt] Change default of allow_user_segv_handler to true"Vitaly Buka
Failed libFuzzer tests on Windows. This reverts commit r303476. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303481 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-20[compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka
Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303476 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-18Revert r302781 and subsequent attempts to disable part of it.Daniel Jasper
The Msan unit tests are still broken and by this point, I think we should start over. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303339 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-17Include setjmp.h unconditionally in asan_test_utils.hHans Wennborg
It's used in asan_test.cc also on Windows, and my build was failing with: C:/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc:549:28: error: unknown type name 'jmp_buf' NOINLINE void LongJmpFunc1(jmp_buf buf) { ^ C:/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc:569:10: error: unknown type name 'jmp_buf' static jmp_buf buf; ^ I couldn't find what changed to make this not work anymore, but this should fix it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303273 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-11[asan] Recommit of r301904: Add strndup/__strndup interceptorsPierre Gousseau
Fix undeclared __interceptor_malloc in esan_interceptors.cc Fix undeclared strnlen on OSX Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302781 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02Revert r301904 causing tsan test failure in x86_64-linux-autoconfPierre Gousseau
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301909 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-02[asan] Add strndup/__strndup interceptors if targeting linux.Pierre Gousseau
Differential Revision: https://reviews.llvm.org/D31457 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301904 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20Define a suppression for known leaks on pthread_exit call.Alex Shlyapnikov
Summary: Refer to D32194 for the context. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32303 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300886 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-19Turn symbolization on for ASan unit test.Alex Shlyapnikov
Summary: On PowerPC and ARM (possibly, need to verify), couple tests involving pthread_exit fail due to leaks detected by LSan. pthread_exit tries to perform unwinding that leads to dlopen'ing libgcc_s.so. dlopen mallocs "libgcc_s.so" string which confuses LSan, it fails to realize that this allocation happens in dynamic linker and should be ignored. Symbolized leak report is required to define a suppression for this known problem. Reviewers: eugenis Subscribers: aemerson, rengolin, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32194 Turn symbolization on for PPC and Thumb only to do not slow down other platforms. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300748 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-12Fix memory leaks in address sanitizer darwin testsFrancis Ricci
Summary: These leaks are detected by leak sanitizer for darwin. Reviewers: glider, kubamracek, kcc, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31978 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300080 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11Reapply "Enable LSan for arm Linux"Maxim Ostapenko
This patch reapplies r299923 with typo fixed in BLX macros. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299948 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11Revert r299923, it doesn't build in bootstrap builds.Nico Weber
FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cc.o lib/sanitizer_common/sanitizer_linux.cc:1340:24: error: invalid instruction BLX(ip) ^ lib/sanitizer_common/sanitizer_linux.cc:1313:19: note: expanded from macro 'BLX' # define BLX(R) "mov lr, pc; bx" #R "\n" ^ <inline asm>:6:13: note: instantiated into assembly here mov lr, pc; bxip ^~~~ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299943 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-11[lsan] Enable LSan for arm LinuxMaxim Ostapenko
This patch enables LSan for arm Linux. Differential Revision: https://reviews.llvm.org/D29586 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@299923 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-27[powerpc] deactivate ManyThreadsTest asan test on powerpc64Bill Seurer
This test case occassionally hangs when run on powerpc. This is also a problem on AArch64 (see https://bugs.llvm.org/show_bug.cgi?id=24389). Reactivate this when the problem is fixed. This could also be related to the same problem as with the tests ThreadedOneSizeMallocStressTest, ThreadedMallocStressTest, and several others that do not run reliably on powerpc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298873 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14Some ASan bots (AArch64 at least) use SEGV for a unit test error instead of ↵Filipe Cabecinhas
SIGBUS git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297728 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-13[asan] Split SIGSEGV / SIGBUS handling so we can handle only one of them and ↵Filipe Cabecinhas
not the other. Summary: This is useful in some platforms where one of these signals is special. Reviewers: kubamracek, kcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30783 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-06[asan] Remove `using std::vector` and `using std::map`Alexander Kornienko
Looks like these are not needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294200 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-25[powerpc] deactivate ThreadedOneSizeMallocStressTest asan test on powerpc64Bill Seurer
This has not reliably worked on powerpc since r279664. Re-enable this once the problem is tracked down and fixed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293066 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-24[powerpc] deactivate ThreadedMallocStressTest asan test on powerpc64Bill Seurer
This has not reliably worked on powerpc since r279664. Re-enable this once the problem is tracked down and fixed. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@292945 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12Revert "[sancov] moving sancov rt to sancov/ directory"Mike Aizatsky
This reverts commit https://reviews.llvm.org/rL291734 Reason: mac breakage http://lab.llvm.org:8080/green//job/clang-stage1-configure-RA_build/28798/consoleFull#1657087648e9a0fee5-ebcc-4238-a641-c5aa112c323e git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291736 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-12[sancov] moving sancov rt to sancov/ directoryMike Aizatsky
Subscribers: kubabrecka, mgorny Differential Revision: https://reviews.llvm.org/D28541 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291734 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10Make cmake link flag naming consistentFrancis Ricci
Summary: The build system was inconsistent in its naming conventions for link flags. This patch changes all uses of LINKFLAGS to LINK_FLAGS, for consistency with cmake's LINK_FLAGS property. This patch should make it easier to search the source code for uses of link flags, as well as providing the benefit of improved style and consistency. Reviewers: compnerd, beanz Subscribers: kubabrecka, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28506 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291539 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09Enable weak hooks on darwinFrancis Ricci
Summary: By default, darwin requires a definition for weak interface functions at link time. Adding the '-U' link flag with each weak function allows these weak interface functions to be used without definitions, which mirrors behavior on linux and windows. Reviewers: compnerd, eugenis Subscribers: kubabrecka, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D28203 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291417 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-05[compiler-rt] Set valid PC calling __asan_report_error ↵Vitaly Buka
SetErrorReportCallbackTest Reviewers: eugenis Subscribers: kubabrecka, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D28376 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@291176 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-28Decrease kLargeMalloc block size in ASAN unit tests.Evgeniy Stepanov
Summary: Make kLargeMalloc big enough to be handled by secondary allocator and small enough to fit into quarantine for all configurations. It become too big to fit into quarantine on Android after D27873. Reviewers: eugenis Patch by Alex Shlyapnikov. Subscribers: danalbert, llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D28142 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290689 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27[asan] Fix test broken by r290540Vitaly Buka
Reviewers: ahatanak, eugenis, myatsina Subscribers: kubabrecka, zizhar, llvm-commits Differential Revision: https://reviews.llvm.org/D28128 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290621 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-26[inline-asm]No error for conflict between inputs\outputs and clobber listMarina Yatsina
Updated test according to commit 290539: According to extended asm syntax, a case where the clobber list includes a variable from the inputs or outputs should be an error - conflict. for example: const long double a = 0.0; int main() { char b; double t1 = a; __asm__ ("fucompp": "=a" (b) : "u" (t1), "t" (t1) : "cc", "st", "st(1)"); return 0; } This should conflict with the output - t1 which is st, and st which is st aswell. The patch fixes it. Commit on behald of Ziv Izhar. Differential Revision: https://reviews.llvm.org/D15075 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290540 91177308-0d34-0410-b5e6-96231b3b80d8