summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/sanitizer_common/TestCases
Commit message (Collapse)AuthorAgeFilesLines
* [Symbolizers] On Darwin compute function offset when possible.Dan Liew2019-11-192-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The sanitizer symbolizers support printing the function offset (difference between pc and function start) of a stackframe using the `%q` format specifier. Unfortunately this didn't actually work because neither the atos or dladdr symbolizer set the `AddressInfo::function_offset` field. This patch teaches both symbolizers to try to compute the function offset. In the case of the atos symbolizer, atos might not report the function offset (e.g. it reports a source location instead) so in this case it fallsback to using `dladdr()` to compute the function offset. Two test cases are included. rdar://problem/56695185 Reviewers: kubamracek, yln Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69549
* [SanitizerCommon] Print the current value of options when printing out help.Dan Liew2019-11-141-2/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously it wasn't obvious what the default value of various sanitizer options were. A very close approximation of the "default values" for the options are the current value of the options at the time of printing the help output. In the case that no other options are provided then the current values are the default values (apart from `help`). ``` ASAN_OPTIONS=help=1 ./program ``` This patch causes the current option values to be printed when the `help` output is enabled. The original intention for this patch was to append `(Default: <value>)` to an option's help text. However because this is technically wrong (and misleading) I've opted to append `(Current Value: <value>)` instead. When trying to implement a way of displaying the default value of the options I tried another solution where the default value used in `*.inc` files were used to create compile time strings that where used when printing the help output. This solution was not satisfactory for several reasons: * Stringifying the default values with the preprocessor did not work very well in several cases. Some options contain boolean operators which no amount of macro expansion can get rid of. * It was much more invasive than this patch. Every sanitizer had to be changed. * The settings of `__<sanitizer>_default_options()` are ignored. For those reasons I opted for the solution in this patch. rdar://problem/42567204 Reviewers: kubamracek, yln, kcc, dvyukov, vitalybuka, cryptoad, eugenis, samsonov Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69546
* [sanitizer_common] Create max_allocation_size_mb flag.Matt Morehouse2019-10-301-0/+127
| | | | | | | | | | | | | | | | | Summary: The flag allows the user to specify a maximum allocation size that the sanitizers will honor. Any larger allocations will return nullptr or crash depending on allocator_may_return_null. Reviewers: kcc, eugenis Reviewed By: kcc, eugenis Subscribers: #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D69576
* Add a missing include in test.Evgeniy Stepanov2019-10-101-0/+1
| | | | | | A fix for r373993. llvm-svn: 374448
* [Sanitizers] Fix getrandom testDavid Carlier2019-10-101-1/+1
| | | | llvm-svn: 374333
* [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 llvm-svn: 374315
* [sanitizer, NFC] Fix grammar in commentVitaly Buka2019-10-091-1/+1
| | | | llvm-svn: 374223
* [sanitizer] Disable signal_trap_handler on s390Vitaly Buka2019-10-091-0/+5
| | | | llvm-svn: 374220
* [sanitizer] Make signal_name a C testVitaly Buka2019-10-091-2/+3
| | | | llvm-svn: 374213
* [sanitizer] Use raise() in test and cover more signalsVitaly Buka2019-10-092-8/+19
| | | | llvm-svn: 374211
* [sanitizer] Fix crypt.cpp on Android againVitaly Buka2019-10-081-3/+3
| | | | llvm-svn: 374125
* [sanitizer] Fix crypt.cpp test on DarwinVitaly Buka2019-10-081-1/+1
| | | | llvm-svn: 374115
* [sanitizer] Disable crypt*.cpp tests on AndroidVitaly Buka2019-10-082-5/+7
| | | | llvm-svn: 374088
* [sanitizer] Fix signal_trap_handler.cpp on androidVitaly Buka2019-10-081-6/+11
| | | | llvm-svn: 374010
* [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 llvm-svn: 373993
* [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 llvm-svn: 373979
* [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 llvm-svn: 373978
* [compiler-rt] Remove O1 tests from signal_line.cppVitaly Buka2019-10-041-4/+0
| | | | | | It does not work on arm llvm-svn: 373702
* [compiler-rt] Fix signal_line.cpp testVitaly Buka2019-10-041-2/+2
| | | | | | r373682 committed wrong experimental version llvm-svn: 373684
* [compiler-rt] Remove O2, O3 from signal_line test for fix android testsVitaly Buka2019-10-041-11/+2
| | | | llvm-svn: 373682
* [compiler-rt] More optimization levels in signal_line.cpp testVitaly Buka2019-10-031-12/+13
| | | | llvm-svn: 373642
* [sanitizer_common] Disable onprint.cpp on Android.Matt Morehouse2019-10-021-0/+2
| | | | | | The test fails to find the written file on Android. llvm-svn: 373531
* [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 llvm-svn: 373529
* [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 llvm-svn: 373518
* [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 llvm-svn: 371453
* [Sanitizer] arc4random interception on MacDavid Carlier2019-08-191-1/+1
| | | | | | | | | | Reviewers: yln,vitalybuka Reviewed By: yln Differential Revision: https://reviews.llvm.org/D66391 llvm-svn: 369285
* [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 llvm-svn: 368492
* [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 llvm-svn: 367999
* Follow-up for r367863 and r367656Nico Weber2019-08-052-2/+2
| | | | llvm-svn: 367888
* compiler-rt: Rename cc files below test/sanitizer_common to cppNico Weber2019-08-05119-23/+23
| | | | | | See r367803 and similar other changes. llvm-svn: 367863
* [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 llvm-svn: 366342
* [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*Reid Kleckner2019-06-275-0/+0
| | | | | | | | | | | | | 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 llvm-svn: 364591
* [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 llvm-svn: 364261
* [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 llvm-svn: 363167
* [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 llvm-svn: 361357
* [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 llvm-svn: 359708
* [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 llvm-svn: 359606
* [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 llvm-svn: 357889
* [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 llvm-svn: 357240
* [NFC][Sanitizer] Test unexpectedly passes on ppc64be botJulian Lettner2019-03-011-1/+1
| | | | llvm-svn: 355239
* [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 llvm-svn: 355232
* 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. llvm-svn: 355204
* 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. llvm-svn: 354906
* [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 llvm-svn: 354851
* [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. llvm-svn: 354701
* [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 llvm-svn: 354695
* [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 llvm-svn: 354522
* [LSan][Darwin][NFC] Add comment explaining test failureJulian Lettner2019-02-181-1/+1
| | | | llvm-svn: 354290
* [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 llvm-svn: 354282
* Revert "Temporarily disable calls to getgrnam/getgrnam_r in test due to it ↵Douglas Yung2019-02-141-4/+2
| | | | | | | | | | hitting unrelated issues in EGLIBC 2.19." This reverts commit r353594. We have updated our internal build bot to a newer version of LIBC which does not have this problem. llvm-svn: 354014
OpenPOWER on IntegriCloud