summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizer] Include inlined frames into __sanitizer_symbolize_pc outputVitaly Buka2018-10-021-0/+30
| | | | | | | | | | | | | | | | Summary: Behavior for existing used is not changing as the first line is going to be the same, and it was invalid to try to read more lines. New clients can read until they get empty string. Reviewers: eugenis, morehouse Subscribers: kubamracek, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D52743 llvm-svn: 343554
* [sanitizer] Small buffer tests for __sanitizer_symbolize_pcVitaly Buka2018-10-011-3/+20
| | | | llvm-svn: 343534
* [UBSan] Partially fix `test/ubsan/TestCases/Misc/log-path_test.cc` so that ↵Dan Liew2018-09-171-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it can run on devices. Summary: In order for this test to work the log file needs to be removed from both from the host and device. To fix this the `rm` `RUN` lines have been replaced with `RUN: rm` followed by `RUN: %device_rm`. Initially I tried having it so that `RUN: %run rm` implicitly runs `rm` on the host as well so that only one `RUN` line is needed. This simplified writing the test however that had two large drawbacks. * It's potentially very confusing (e.g. for use of the device scripts outside of the lit tests) if asking for `rm` to run on device also causes files on the host to be deleted. * This doesn't work well with the glob patterns used in the test. The host shell expands the `%t.log.*` glob pattern and not on the device so we could easily miss deleting old log files from previous test runs if the corresponding file doesn't exist on the host. So instead deletion of files on the device and host are explicitly separate commands. The command to delete files from a device is provided by a new substitution `%device_rm` as suggested by Filipe Cabecinhas. The semantics of `%device_rm` are that: * It provides a way remove files from a target device when the host is not the same as the target. In the case that the host and target are the same it is a no-op. * It interprets shell glob patterns in the context of the device file system instead of the host file system. This solves the globbing problem provided the argument is quoted so that lit's underlying shell doesn't try to expand the glob pattern. * It supports the `-r` and `-f` flags of the `rm` command, with the same semantics. Right now an implementation of `%device_rm` is provided only for ios devices. For all other devices a lit warning is emitted and the `%device_rm` is treated as a no-op. This done to avoid changing the behaviour for other device types but leaves room for others to implement `%device_rm`. The ios device implementation uses the `%run` wrapper to do the work of removing files on a device. The `iossim_run.py` script has been fixed so that it just runs `rm` on the host operating system because the device and host file system are the same. rdar://problem/41126835 Reviewers: vsk, kubamracek, george.karpenkov, eugenis Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D51648 llvm-svn: 342391
* [UBSan] Propagate `UBSAN_OPTIONS` environment variable when running ios ↵Dan Liew2018-09-031-1/+1
| | | | | | | | | | | | | | simulator tests. rdar://problem/41126835 Reviewers: kubamracek, vsk, george.karpenkov Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D51273 llvm-svn: 341299
* [CMake] Use normalized Windows target triplesPetr Hosek2018-08-093-3/+3
| | | | | | | | | | | Changes the default Windows target triple returned by GetHostTriple.cmake from the old environment names (which we wanted to move away from) to newer, normalized ones. This also requires updating all tests to use the new systems names in constraints. Differential Revision: https://reviews.llvm.org/D47381 llvm-svn: 339307
* [compiler-rt] Get rid of "%T" expansionsFilipe Cabecinhas2018-07-101-2/+3
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 336661
* [asan] Change 3 tests from XFAIL to UNSUPPORTED.Evgeniy Stepanov2018-06-282-2/+2
| | | | | | The failure in https://github.com/google/sanitizers/issues/981 is flaky. llvm-svn: 335941
* [asan] Disable 3 tests on Android O+.Evgeniy Stepanov2018-06-282-0/+7
| | | | | | https://github.com/google/sanitizers/issues/981 llvm-svn: 335937
* [asan] Fix one more test on Android.Evgeniy Stepanov2018-06-281-3/+5
| | | | | | | | | | This change makes it pass both on libstdc++ and libc++-based toolchains. The error was: error: function-like macro '__GLIBC_PREREQ' is not defined ^ llvm-svn: 335936
* [sanitizer] Unify and generalize Apple platforms in CMake and lit test configsKuba Mracek2018-06-201-0/+5
| | | | | | | | 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 llvm-svn: 335123
* [TSan] Report proper error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-06-184-35/+59
| | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 334975
* [ASAN] fix fgets and fgets_fputs tests failurePeter Wu2018-06-121-2/+2
| | | | | | Some systems (Android) might not have /etc/passwd. Fixes r334450. llvm-svn: 334487
* [sanitizer] Add fgets, fputs and puts into sanitizer_commonPeter Wu2018-06-112-0/+38
| | | | | | | | | | | | | | | 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] %tool_options -> %env_tool_opts in allocator_returns_null.ccAlex Shlyapnikov2018-06-111-14/+14
| | | | | | Use proper substitution in the common allocator_returns_null.cc test. llvm-svn: 334438
* [Sanitizers] Move allocator_returns_null.cc test to common.Alex Shlyapnikov2018-06-111-0/+118
| | | | | | | | | | | | | | | | 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-0/+46
| | | | | | | | | | | | | | | | | | | 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
* [MSan] Switch to common aligned allocs tests.Alex Shlyapnikov2018-06-093-5/+8
| | | | | | | | | | | | | | 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 llvm-svn: 334340
* [Sanitizers] Use proper substitution in common allocator test.Alex Shlyapnikov2018-06-082-8/+8
| | | | | | Use %env_tool_ops instead of %tool_options. llvm-svn: 334332
* [Sanitizers] Check alignment != 0 for aligned_alloc and posix_memalignAlex Shlyapnikov2018-06-082-0/+63
| | | | | | | | | | | | | | | 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
* [sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlockVitaly Buka2018-05-151-0/+34
| | | | | | | | | | Reviewers: eugenis, dvyukov Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D46793 llvm-svn: 332320
* Revert "[sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlock"Vitaly Buka2018-05-141-34/+0
| | | | | | | | Tsan tests fail. This reverts commit r332268 llvm-svn: 332276
* [sanitizer] Intercept __pthread_mutex_lock and __pthread_mutex_unlockVitaly Buka2018-05-141-0/+34
| | | | | | | | | | Reviewers: eugenis, dvyukov Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D46793 llvm-svn: 332268
* [lsan] Try to fix test failure due to compiler optimizationPeter Wu2018-05-101-7/+4
| | | | | | | | | | | | | | 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 llvm-svn: 332020
* Add s390x to XFAIL for illegal_read/write_test.ccPetar Jovanovic2018-04-252-2/+2
| | | | | | | | | 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. llvm-svn: 330863
* Finetune supported arches for the tests added in r330840Petar Jovanovic2018-04-252-0/+2
| | | | | | | r330840 introduced two tests that may not be supported on all architectures. powerpc64 seems to be one of those. llvm-svn: 330849
* [mips] Implement GetWriteFlag() for mipsPetar Jovanovic2018-04-252-0/+27
| | | | | | | | | | | | | 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 llvm-svn: 330840
* [ASan] Report proper ASan error on allocator failures instead of CHECK(0)-ingAlex Shlyapnikov2018-03-281-1/+1
| | | | | | | | | | | | | | | | | | 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
* [sanitizer] Make test compatible with DarwinVitaly Buka2018-03-262-3/+3
| | | | llvm-svn: 328467
* Mmap interceptor providing mprotect supportVitaly Buka2018-03-241-2/+24
| | | | | | | | | | | | | | | | 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 llvm-svn: 328415
* FreeBSD sanitizer common, intercept couple of more functionsVitaly Buka2018-03-239-3/+16
| | | | | | | | | | | | | | | 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 llvm-svn: 328376
* Revert "Mmap interceptor providing mprotect support"Vitaly Buka2018-03-231-24/+2
| | | | | | | | Breaks Darwin. This reverts commit r328369. llvm-svn: 328375
* Mmap interceptor providing mprotect supportVitaly Buka2018-03-231-2/+24
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 328369
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-211-0/+15
| | | | | | | | | | | | | | | | | | 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 llvm-svn: 328151
* Revert "Mmap interceptor new option, Write Exec runtime detector"Vitaly Buka2018-03-171-12/+0
| | | | | | | | Breaks Android bot. This reverts commit r327747. llvm-svn: 327762
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-161-0/+12
| | | | | | | | | | | | | | | | 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 llvm-svn: 327747
* Revert "Mmap interceptor new option, Write Exec runtime detector"Jonas Devlieghere2018-03-161-12/+0
| | | | | | | | | 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/ llvm-svn: 327719
* Mmap interceptor new option, Write Exec runtime detectorVitaly Buka2018-03-161-0/+12
| | | | | | | | | | | | | | | | 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 llvm-svn: 327696
* Disable tests from r326852 on DarwinAdam Nemet2018-03-072-0/+2
| | | | | | | | | | 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 llvm-svn: 326874
* [sanitizer] Move strxfrm interceptors into sanitizer_commonVitaly Buka2018-03-071-0/+19
| | | | llvm-svn: 326853
* [sanitizer] Add interceptors for wcsxfrm, wcsxfrm_lVitaly Buka2018-03-071-0/+19
| | | | | | | | | | | | | | Patch by Oliver Chang Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44133 llvm-svn: 326852
* [sanitizer] Move mmap interceptors into sanitizer_commonVitaly Buka2018-03-072-0/+24
| | | | | | | | | | Reviewers: devnexen, krytarowski, eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D44125 llvm-svn: 326851
* Add new interceptors: getnetent(3) familyKamil Rytarowski2018-02-271-0/+84
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 326163
* Add new interceptors: getprotoent(3) familyKamil Rytarowski2018-02-271-0/+89
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 326162
* Add new interceptors: getttyent(3) familyKamil Rytarowski2018-02-271-0/+70
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 326161
* Correct ctype(3) functions with NLS on NetBSDKamil Rytarowski2018-02-241-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 326008
* Add new interceptor: strmode(3)Kamil Rytarowski2018-02-201-0/+20
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 325588
* Add new interceptor: fgetln(3)Kamil Rytarowski2018-02-201-0/+23
| | | | | | | | | | | | | | | | | | | 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 llvm-svn: 325587
* Add new interceptor: lstat(2)Kamil Rytarowski2018-02-151-0/+16
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 325199
* [sanitizer] Fix flakiness in the testsVitaly Buka2018-02-152-7/+2
| | | | | | | Seems tests fails if link already exists. Also removed duplicated part of tests. llvm-svn: 325194
* Correct FileCheck usage in two newly added testsKamil Rytarowski2018-02-022-2/+2
| | | | llvm-svn: 324121
OpenPOWER on IntegriCloud