summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
AgeCommit message (Collapse)Author
2018-07-10[compiler-rt] Get rid of "%T" expansionsFilipe Cabecinhas
Summary: Original patch by Kuba Mracek The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t. This patch removes %T in compiler-rt. Differential Revision: https://reviews.llvm.org/D48618 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@336661 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-20[sanitizer] Unify and generalize Apple platforms in CMake and lit test configsKuba Mracek
There's more platforms than just "ios" and "iossim" that we should support, and adding more lit config variables for each platform isn't great. Let's generalize and have a single value that determines what the platform under test is. Differential Revision: https://reviews.llvm.org/D48309 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@335123 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-18[TSan] Report proper error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov
Summary: Following up on and complementing D44404 and other sanitizer allocators. Currently many allocator specific errors (OOM, for example) are reported as a text message and CHECK(0) termination, no stack, no details, not too helpful nor informative. To improve the situation, detailed and structured common errors were defined and reported under the appropriate conditions. Common tests were generalized a bit to cover a slightly different TSan stack reporting format, extended to verify errno value and returned pointer value check is now explicit to facilitate debugging. Reviewers: dvyukov Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D48087 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334975 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-12[ASAN] fix fgets and fgets_fputs tests failurePeter Wu
Some systems (Android) might not have /etc/passwd. Fixes r334450. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334487 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11[sanitizer] Add fgets, fputs and puts into sanitizer_commonPeter Wu
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334450 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11[Sanitizers] %tool_options -> %env_tool_opts in allocator_returns_null.ccAlex Shlyapnikov
Use proper substitution in the common allocator_returns_null.cc test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334438 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11[Sanitizers] Move allocator_returns_null.cc test to common.Alex Shlyapnikov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334433 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11[Sanitizers] Move pvalloc overflow tests to common.Alex Shlyapnikov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334424 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-09[MSan] Switch to common aligned allocs tests.Alex Shlyapnikov
Summary: Switch to aligned_alloc and posix_memalign tests in sanitizer_common and delete the MSan-specific ones. Reviewers: vitalybuka Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D47968 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334340 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-08[Sanitizers] Use proper substitution in common allocator test.Alex Shlyapnikov
Use %env_tool_ops instead of %tool_options. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334332 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-08[Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalignAlex Shlyapnikov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334316 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-15[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlockVitaly Buka
Reviewers: eugenis, dvyukov Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D46793 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332320 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14Revert "[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock"Vitaly Buka
Tsan tests fail. This reverts commit r332268 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332276 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlockVitaly Buka
Reviewers: eugenis, dvyukov Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D46793 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332268 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-10[lsan] Try to fix test failure due to compiler optimizationPeter Wu
Summary: The SanitizerCommon-lsan-x86_64-Linux test failed due to the address of the very first allocation ending up in the stack through "delete[]". Workaround this by performing another allocation. The issue was only present with optimization enabled, the test would pass with -O0. Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D46650 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332020 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25Add s390x to XFAIL for illegal_read/write_test.ccPetar Jovanovic
Follow up to r330840 and r330849. It seems that s390 is also not distinguishing illegal WRITE and READ memory access. Add s390x to XFAIL for the tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330863 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25Finetune supported arches for the tests added in r330840Petar Jovanovic
r330840 introduced two tests that may not be supported on all architectures. powerpc64 seems to be one of those. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330849 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-25[mips] Implement GetWriteFlag() for mipsPetar Jovanovic
The read/write flag is set by manually decoding the instruction that caused the exception. It is implemented this way because the cause register which contains the needed flag was removed from the signal context structure which the user handler receives from the kernel. Patch by Milos Stojanovic. Differential Revision: https://reviews.llvm.org/D45768 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@330840 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-28[ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328722 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-26[sanitizer] Make test compatible with DarwinVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328467 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-24Mmap interceptor providing mprotect supportVitaly Buka
Summary: - Intercepting mprotect calls. - Fixing forgotten flag check. Patch by David CARLIER Reviewers: vitalybuka, vsk Subscribers: delcypher, srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44777 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328415 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23FreeBSD sanitizer common, intercept couple of more functionsVitaly Buka
Summary: Intercepts lstat, acct, access, faccessat and strlcpy/strlcat Patch by David CARLIER Reviewers: visa, vitalybuka Subscribers: krytarowski, fedor.sergeev, srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44432 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328376 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23Revert "Mmap interceptor providing mprotect support"Vitaly Buka
Breaks Darwin. This reverts commit r328369. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328375 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-23Mmap interceptor providing mprotect supportVitaly Buka
Summary: - Intercepting mprotect calls. - Fixing forgotten flag check. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44777 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328369 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-21Mmap interceptor new option, Write Exec runtime detectorVitaly Buka
Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@328151 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-17Revert "Mmap interceptor new option, Write Exec runtime detector"Vitaly Buka
Breaks Android bot. This reverts commit r327747. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327762 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16Mmap interceptor new option, Write Exec runtime detectorVitaly Buka
Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327747 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16Revert "Mmap interceptor new option, Write Exec runtime detector"Jonas Devlieghere
This reverts r327696 because it is failing on GreenDragon. http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/43605/ http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-expensive/10957/ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327719 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-16Mmap interceptor new option, Write Exec runtime detectorVitaly Buka
Summary: Following-up the refactoring of mmap interceptors, adding a new common option to detect PROT_WRITE|PROT_EXEC pages request. Patch by David CARLIER Reviewers: vitalybuka, vsk Reviewed By: vitalybuka Subscribers: krytarowski, #sanitizers Differential Revision: https://reviews.llvm.org/D44194 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327696 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07Disable tests from r326852 on DarwinAdam Nemet
Darwin needs xlocale.h but I see no precedence in the code how non-Posix headers like this are handled and I am not experienced with this code. Just disable the tests for now to recover the bots. rdar://38208146 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326874 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07[sanitizer] Move strxfrm interceptors into sanitizer_commonVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326853 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07[sanitizer] Add interceptors for wcsxfrm, wcsxfrm_lVitaly Buka
Patch by Oliver Chang Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44133 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326852 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-07[sanitizer] Move mmap interceptors into sanitizer_commonVitaly Buka
Reviewers: devnexen, krytarowski, eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44125 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326851 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-27Add new interceptors: getnetent(3) familyKamil Rytarowski
Summary: getnetent, getnetbyaddr, getnetbyname - get network entry Reuse them on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43543 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326163 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-27Add new interceptors: getprotoent(3) familyKamil Rytarowski
Summary: getprotoent, getprotobynumber, getprotobyname - get protocol entry Reuse them on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43541 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326162 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-27Add new interceptors: getttyent(3) familyKamil Rytarowski
Summary: getttyent, getttynam, setttyentpath - get ttys file entry Reuse them on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43539 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326161 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-24Correct ctype(3) functions with NLS on NetBSDKamil Rytarowski
Summary: The setlocale(3) function reloads the ctype(3) arrays from external files. This happens behind the scenes in the internals of libc (citrus library, runes functions etc). ctype(3) functions like isspace(3) can be provided with two variations on NetBSD: inlined or via a global symbol in libc: ``` #if defined(_NETBSD_SOURCE) && !defined(_CTYPE_NOINLINE) && \ !defined(__cplusplus) #include <sys/ctype_inline.h> #else #include <sys/ctype_bits.h> #endif ``` The in-lined versions are de-facto array lookup operations. ``` #define isspace(c) ((int)((_ctype_tab_ + 1)[(c)] & _CTYPE_S)) ``` After setting setlocale(3) the ctype(3) arrays (_ctype_tab_, _toupper_tab_, _tolower_tab_) are reload behind the scenes and they are required to be marked as initialized. Set them initialized inside the common setlocale(3) interceptor. The arrays are of size of 257 elements: 0..255 + 1 (EOF). This corrects errors on NetBSD/amd64 in applications prebuilt with MSan. Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, dvyukov, joerg Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42020 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326008 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-20Add new interceptor: strmode(3)Kamil Rytarowski
Summary: strmode - convert inode status information into a symbolic string Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43485 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325588 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-20Add new interceptor: fgetln(3)Kamil Rytarowski
Summary: fgetln - get a line from a stream Sponsored by <The NetBSD Foundation> Reviewers: vitalybuka, joerg Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D43482 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325587 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15Add new interceptor: lstat(2)Kamil Rytarowski
Summary: lstat - get file status Use it on NetBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, eugenis Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42909 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325199 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-15[sanitizer] Fix flakiness in the testsVitaly Buka
Seems tests fails if link already exists. Also removed duplicated part of tests. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@325194 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-02Correct FileCheck usage in two newly added testsKamil Rytarowski
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@324121 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-02Add new NetBSD interceptors: devname(3), devname_r(3)Kamil Rytarowski
Summary: devname, devname_r - get device name Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42053 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@324120 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01Add new interceptors: strlcpy(3) and strlcat(3)Kamil Rytarowski
Summary: NetBSD ships with strlcpy(3) and strlcat(3), a safe replacement of strcpy(3) and strcat(3). Hide both functions under SANITIZER_INTERCEPT_STRLCPY. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits, kubamracek, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D42061 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@324034 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01[sanitizer] Fix array sizes used for path in testsVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@324022 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-01Update readlink.c and readlinkat.c to use larger buffers on Darwin.Kuba Mracek
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@324016 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-31[sanitizer] Move readlinkat.c test from Linux to PosixVitaly Buka
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@323837 91177308-0d34-0410-b5e6-96231b3b80d8