summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
Commit message (Collapse)AuthorAgeFilesLines
* [Sanitizers] Porting getrandom/getentropy interceptors to FreeBSDDavid Carlier2019-10-101-4/+8
| | | | | | | | | | | | | - Available from 12.x branch, by the time it lands next year in FreeBSD tree, the 11.x's might be EOL. - Intentionally changed the getrandom test to C code as with 12.0 (might be fixed in CURRENT since), there is a linkage issue in C++ context. Reviewers: emaste, dim, vitalybuka Reviewed-By: vitalybuka Differential Revision: https://reviews.llvm.org/D68451 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374315 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer, NFC] Fix grammar in commentVitaly Buka2019-10-091-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374223 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Disable signal_trap_handler on s390Vitaly Buka2019-10-091-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374220 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Make signal_name a C testVitaly Buka2019-10-091-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374213 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Use raise() in test and cover more signalsVitaly Buka2019-10-092-8/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374211 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Fix crypt.cpp on Android againVitaly Buka2019-10-082-6/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374125 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Fix crypt.cpp test on DarwinVitaly Buka2019-10-082-4/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374115 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Disable crypt*.cpp tests on AndroidVitaly Buka2019-10-082-5/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374088 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Fix signal_trap_handler.cpp on androidVitaly Buka2019-10-081-6/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@374010 91177308-0d34-0410-b5e6-96231b3b80d8
* [msan] Add interceptors: crypt, crypt_r.Evgeniy Stepanov2019-10-082-0/+63
| | | | | | | | | | | | Reviewers: vitalybuka Subscribers: srhines, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68431 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373993 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Print SIGTRAP for corresponding signalVitaly Buka2019-10-071-0/+8
| | | | | | | | | | | | Reviewers: eugenis, jfb Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68603 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373979 91177308-0d34-0410-b5e6-96231b3b80d8
* [tsan] Don't delay SIGTRAP handlerVitaly Buka2019-10-071-0/+29
| | | | | | | | | | | | Reviewers: eugenis, jfb Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68604 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373978 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Remove O1 tests from signal_line.cppVitaly Buka2019-10-041-4/+0
| | | | | | It does not work on arm git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373702 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Fix signal_line.cpp testVitaly Buka2019-10-041-2/+2
| | | | | | r373682 committed wrong experimental version git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373684 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Remove O2, O3 from signal_line test for fix android testsVitaly Buka2019-10-041-11/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373682 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] More optimization levels in signal_line.cpp testVitaly Buka2019-10-031-12/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373642 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer_common] Disable onprint.cpp on Android.Matt Morehouse2019-10-021-0/+2
| | | | | | The test fails to find the written file on Android. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373531 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Use GetNextInstructionPc in signal handlersVitaly Buka2019-10-021-0/+36
| | | | | | | | | | | | | | | | | | Summary: All other stack trace callers assume that PC contains return address. HWAsan already use GetNextInstructionPc in similar code. PR43339 Reviewers: eugenis, kcc, jfb Subscribers: dexonsmith, dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D68313 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373529 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer_common] Rename OnPrint to __sanitizer_on_print.Matt Morehouse2019-10-021-0/+31
| | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/D28596 exposed OnPrint in the global namespace, which can cause collisions with user-defined OnPrint() functions. Reviewers: vitalybuka, dvyukov Reviewed By: vitalybuka, dvyukov Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67987 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@373518 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Run cpplint only for check-sanitizerVitaly Buka2019-09-121-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@371703 91177308-0d34-0410-b5e6-96231b3b80d8
* [UBSan] Follow up fix for r371442.Max Moroz2019-09-091-1/+1
| | | | | | | | | | | | | | Reviewers: vitalybuka, hctim, Dor1s Reviewed By: Dor1s Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D67371 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@371453 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] arc4random interception on MacDavid Carlier2019-08-191-1/+1
| | | | | | | | | | Reviewers: yln,vitalybuka Reviewed By: yln Differential Revision: https://reviews.llvm.org/D66391 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@369285 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer][Darwin] Add interceptor for malloc_zone_from_ptrJulian Lettner2019-08-091-0/+45
| | | | | | | | | | | | | | | | | Ensure that malloc_default_zone and malloc_zone_from_ptr return the sanitizer-installed malloc zone even when MallocStackLogging (MSL) is requested. This prevents crashes in certain situations. Note that the sanitizers and MSL cannot be used together. If both are enabled, MSL functionality is essentially deactivated since it only hooks the default allocator which is replaced by a custom sanitizer allocator. rdar://53686175 Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D65990 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@368492 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Implement getrandom interceptionVitaly Buka2019-08-061-0/+22
| | | | | | | | | | | | | | | | | | | | | | | Summary: Straightforward implementation of `getrandom` syscall and libc hooks. Test Plan: Local MSAN failures caused by uninstrumented `getrandom` calls stop failing. Patch by Andrew Krieger. Reviewers: eugenis, vitalybuka Reviewed By: vitalybuka Subscribers: srhines, kubamracek, dberris, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65551 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367999 91177308-0d34-0410-b5e6-96231b3b80d8
* compiler-rt: Remove .cc from all lit config filesNico Weber2019-08-051-1/+1
| | | | | | All cc files have been renamed to cpp now. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367911 91177308-0d34-0410-b5e6-96231b3b80d8
* Follow-up for r367863 and r367656Nico Weber2019-08-052-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367888 91177308-0d34-0410-b5e6-96231b3b80d8
* compiler-rt: Rename cc files below test/sanitizer_common to cppNico Weber2019-08-05119-23/+23
| | | | | | | See r367803 and similar other changes. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@367863 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Support `{f}puts(NULL)` on DarwinJulian Lettner2019-07-171-0/+16
| | | | | | | | | | | | | On Darwin, the man page states that "both fputs() and puts() print `(null)' if str is NULL." rdar://48227136 Reviewed By: Lekensteyn Differential Revision: https://reviews.llvm.org/D64773 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@366342 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*Reid Kleckner2019-06-279-5/+5
| | | | | | | | | | | | | These lit configuration files are really Python source code. Using the .py file extension helps editors and tools use the correct language mode. LLVM and Clang already use this convention for lit configuration, this change simply applies it to all of compiler-rt. Reviewers: vitalybuka, dberris Differential Revision: https://reviews.llvm.org/D63658 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@364591 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Enabled getpw_getgr.cc on iOSVitaly Buka2019-06-251-1/+0
| | | | | | | | | | | | | | Reviewers: kubamracek, delcypher, yln Reviewed By: delcypher Subscribers: yln, delcypher, llvm-commits, kubamracek, #sanitizers Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D57786 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@364261 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Fix name_to_handle_at.cc test on Overlay2 (for Docker)Amy Kwan2019-06-121-1/+1
| | | | | | | | | | | | | This patch aims to fix the test case, name_to_handle_at.cc that fails on Docker. Overlay2 on Docker does not support the current check for the name_to_handle_at() function call of the test case. The proposed fix is to check for /dev/null in the test instead, as this check is supported. Checking for /dev/null has been utilized in the past for other test cases, as well. Differential Revision: https://reviews.llvm.org/D63094 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@363167 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Add interceptor for wcsdupPavel Labath2019-05-221-0/+15
| | | | | | | | | | | | | | Summary: The wide-string equivalent of strdup. Implementation trivial. Reviewers: vitalybuka, eugenis Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D62189 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@361357 91177308-0d34-0410-b5e6-96231b3b80d8
* [sanitizer] Implement reallocarray.Evgeniy Stepanov2019-05-011-0/+19
| | | | | | | | | | | | | | | | Summary: It's a cross of calloc and realloc. Sanitizers implement calloc-like check for size overflow. Reviewers: vitalybuka, kcc Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61108 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359708 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt][builtins][sanitizers] Update compiler-rt test cases forAmy Kwan2019-04-301-6/+8
| | | | | | | | | | | | | | | | compatibility with system's toolchain This patch aims to: - Guard ompiler-rt/test/builtins/Unit/compiler_rt_logb_test.c with macros, so the test runs on GLIBC versions >= 2.23. This is because the test relies on comparing its computed values to libm. Oolder versions might not compute to the same value as the compiler-rt value. - Update compiler-rt/test/sanitizer_common/TestCases/Posix/getpw_getgr.cc so that std::string is not used, since false positives may be detected. Differential Revision: https://reviews.llvm.org/D60644 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359606 91177308-0d34-0410-b5e6-96231b3b80d8
* [TSan] Support fiber API on macOSJulian Lettner2019-04-201-0/+11
| | | | | | | | | | | | | | Committing on behalf of Yuri Per (yuri). Reviewers: dvyukov, kubamracek, yln Reviewed By: kubamracek Authored By: yuri Differential Revision: https://reviews.llvm.org/D58110 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@358802 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Fix a possible write to freed memory in the wcrtomb interceptorPavel Labath2019-04-081-0/+36
| | | | | | | | | | | | | | | | | | Summary: r357240 added an interceptor for wctomb, which uses a temporary local buffer to make sure we don't write to unallocated memory. This patch applies the same technique to wcrtomb, and adds some additional tests for this function. Reviewers: vitalybuka, eugenis Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59984 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@357889 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Add interceptor for wctombPavel Labath2019-03-291-0/+14
| | | | | | | | | | | | | | | | | Summary: This is required to avoid msan false positives for code using this function (although generally one should avoid using this function in favor of wcrtomb). Reviewers: eugenis, EricWF, vitalybuka Subscribers: srhines, kubamracek, fedor.sergeev, delcypher, llvm-commits, #sanitizers Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D59548 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@357240 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable `asan/TestCases/Posix/start-deactivated.cc` test for iOS.Dan Liew2019-03-211-1/+1
| | | | | | | | | | | | | | | | | | | Summary: To make this test pass it was necesary to change `iossim_run.py` to propagate the `ASAN_ACTIVATION_OPTIONS` environment variable into the testing environment. rdar://problem/49114807 Reviewers: kubamracek, yln, serge-sans-paille Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D59660 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@356701 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC][Sanitizer] Test unexpectedly passes on ppc64be botJulian Lettner2019-03-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355239 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC][Sanitizer] Make GetStackTrace a private method of BufferedStackTraceJulian Lettner2019-03-011-0/+3
| | | | | | | | | | | GetStackTrace is a implementation detail of BufferedStackTrace. Make it a private method. Reviewed By: vitalybuka Differential-Revision: https://reviews.llvm.org/D58753 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355232 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland "[compiler-rt] Intercept the bcmp() function."Clement Courbet2019-03-011-1/+10
| | | | | | | Fix test issues on darwin: The REQUIRES for the test should be the same as the guard for whether we intercept bcmp. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355204 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] lit test config: Respect existing parallelism_groupJulian Lettner2019-02-281-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355128 91177308-0d34-0410-b5e6-96231b3b80d8
* [Darwin][NFC] Refactor throttling of 64bit sanitizer tests on DarwinJulian Lettner2019-02-272-3/+4
| | | | | | | | | | | | | | | | | | | Underlying condition for throttling is "has large mmap'd regions" (i.e., shadow memory) and not sanitizers in general (e.g., UBSan does not need to be throttled). Rename parallelism group `darwin-64bit-sanitizer` to `shadow-memory` and apply it unconditionally to all tests which require it. We can then have all the Darwin throttling logic in one place in the commen lit config. Throttle sanitizer_common unit tests. Configuration was previously missing from sanitizer_common/Unit/lit.site.cfg. Reviewed by: kubamracek Differential Revision: https://reviews.llvm.org/D58677 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@355018 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[compiler-rt] Intercept the bcmp() function."Vlad Tsyrklevich2019-02-261-11/+1
| | | | | | | This reverts commits r354851, 354852, 354853 and r354888. They were causing build failures on the android sanitizer bot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354906 91177308-0d34-0410-b5e6-96231b3b80d8
* [compiler-rt] Intercept the bcmp() function.Clement Courbet2019-02-261-1/+11
| | | | | | | | | | | | | | | | | | | | | Summary: I have not introduced a separate hook for `bcmp()` as I don't think there should be any reason for a sanitizer to treat it differently from `memcmp()`. This is only enabled when building on POSIX with GNU extensions. Context: this is to avoid losing coverage when emitting `bcmp() == 0` instead of `memcmp() == 0` in llvm, see https://reviews.llvm.org/D56593. Reviewers: mgorny, krytarowski, vitalybuka, dvyukov Subscribers: kubamracek, dberris, delcypher, jdoerfert, #sanitizers, llvm-commits, jyknight Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D58379 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354851 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC][Sanitizer] Re-enable test on DarwinJulian Lettner2019-02-221-3/+0
| | | | | | | This unexpectedly passes on our CI, although it still fails on my machine. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354701 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] Fix uses of stack->Unwind(..., fast)Julian Lettner2019-02-221-2/+2
| | | | | | | | | | | Apply StackTrace::WillUseFastUnwind(fast) in a few more places missed by my previous patch (https://reviews.llvm.org/D58156). Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58550 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354695 91177308-0d34-0410-b5e6-96231b3b80d8
* [LSan] Fix `__sanitizer_print_stack_trace` via fast unwinderJulian Lettner2019-02-203-5/+2
| | | | | | | | | | Summary: Quick follow-up to: https://reviews.llvm.org/D58156 Reviewers: vitalybuka Differential Revision: https://reviews.llvm.org/D58358 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354522 91177308-0d34-0410-b5e6-96231b3b80d8
* [LSan][Darwin][NFC] Add comment explaining test failureJulian Lettner2019-02-181-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354290 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sanitizer] On Darwin `__sanitizer_print_stack_trace` only prints topmost frameJulian Lettner2019-02-182-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In compiler-rt we have the notion of a `fast` and a `slow` stack unwinder. Darwin currently only supports the fast unwinder. From reading the code, my understanding is that `BufferedStackTrace::Unwind` can be called with `bp=0, stack_top=0, stack_bottom=0, request_fast_unwind=false`. If `request_fast_unwind=true`, then we alos need to supply bp, stack_top, and stack_bottom. However, `BufferedStackTrace::Unwind` uses `StackTrace::WillUseFastUnwind` which will adapt `request_fast_unwind` if the requested unwinder is not supported. On Darwin, the result is that we don't pass actual values for bp, stack_top, and stack_bottom, but end up using the fast unwinder. The tests then fail because we only print the topmost stack frame. This patch adds a check to `WillUseFastUnwind` at the point of usage to avoid the mismatch between `request_fast_unwind` and what `Unwind` actually does. I am also interested in cleaning up the `request_fast_unwind` machinery so this patch just the simplest thing possible so I can enable the tests. Reviewers: vitalybuka, vsk Differential Revision: https://reviews.llvm.org/D58156 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354282 91177308-0d34-0410-b5e6-96231b3b80d8