summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/ubsan/TestCases/Misc
Commit message (Collapse)AuthorAgeFilesLines
* [UBSan] Do not overwrite the default print_summary sanitizer option.Max Moroz2019-09-091-0/+11
| | | | | | | | | | | | | | | | | | | | | Summary: This option is true by default in sanitizer common. The default false value was added a while ago without any reasoning in https://github.com/llvm-mirror/compiler-rt/commit/524e934112a593ac081bf2b05aa0d60a67987f05 so, presumably it's safe to remove for consistency. Reviewers: hctim, samsonov, morehouse, kcc, vitalybuka Reviewed By: hctim, samsonov, vitalybuka Subscribers: delcypher, #sanitizers, llvm-commits, kcc Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D67193 llvm-svn: 371442
* compiler-rt: Rename last few cc files below test/ubsan to cppNico Weber2019-08-054-3/+3
| | | | | | See r367803 and similar other changes. llvm-svn: 367855
* [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*Reid Kleckner2019-06-271-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
* Revert "[Sanitizers] UBSan unreachable incompatible with ASan in the ↵Julian Lettner2019-01-241-16/+0
| | | | | | | | presence of `noreturn` calls" This reverts commit cea84ab93aeb079a358ab1c8aeba6d9140ef8b47. llvm-svn: 352069
* Temporarily deactivate tests; it fails on certain botsJulian Lettner2019-01-241-1/+1
| | | | llvm-svn: 352020
* [ubsan] Fix test when isPICDefault() returns false after rCTE352003Fangrui Song2019-01-241-1/+1
| | | | llvm-svn: 352013
* [Sanitizers] UBSan unreachable incompatible with ASan in the presence of ↵Julian Lettner2019-01-241-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `noreturn` calls Summary: UBSan wants to detect when unreachable code is actually reached, so it adds instrumentation before every `unreachable` instruction. However, the optimizer will remove code after calls to functions marked with `noreturn`. To avoid this UBSan removes `noreturn` from both the call instruction as well as from the function itself. Unfortunately, ASan relies on this annotation to unpoison the stack by inserting calls to `_asan_handle_no_return` before `noreturn` functions. This is important for functions that do not return but access the the stack memory, e.g., unwinder functions *like* `longjmp` (`longjmp` itself is actually "double-proofed" via its interceptor). The result is that when ASan and UBSan are combined, the `noreturn` attributes are missing and ASan cannot unpoison the stack, so it has false positives when stack unwinding is used. Changes: # UBSan now adds the `expect_noreturn` attribute whenever it removes the `noreturn` attribute from a function # ASan additionally checks for the presence of this attribute Generated code: ``` call void @__asan_handle_no_return // Additionally inserted to avoid false positives call void @longjmp call void @__asan_handle_no_return call void @__ubsan_handle_builtin_unreachable unreachable ``` The second call to `__asan_handle_no_return` is redundant. This will be cleaned up in a follow-up patch. rdar://problem/40723397 Reviewers: delcypher, eugenis Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D56624 llvm-svn: 352003
* [UBSan] Partially fix `test/ubsan/TestCases/Misc/log-path_test.cc` so that ↵Dan Liew2018-09-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [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
* [test] Use printf instead of C++ iostream, NFC.Jonas Hahnfeld2018-07-261-4/+4
| | | | | | | | | | | This test fails with libc++ when built with MemorySanitizer. This is because we link to an uninstrumented version of the library so msan detects a nested error when calling std::cout << "...". This can be easily avoided by using good old printf. Differential Revision: https://reviews.llvm.org/D49867 llvm-svn: 338053
* [compiler-rt] Get rid of "%T" expansionsFilipe Cabecinhas2018-07-101-7/+7
| | | | | | | | | | | | | | | | | | | 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
* [UBsan] Enable subset of unit tests for OpenBSDDavid Carlier2018-06-303-0/+6
| | | | | | | | | | Reviewers: kubamracek, krytarowski Reviewed By: krytarowski Differential Revision: https://reviews.llvm.org/D48805 llvm-svn: 336053
* [ubsan] Mark a test case as unsupported on WindowsVedant Kumar2018-06-251-2/+7
| | | | | | | | | __ubsan_on_report isn't defined as weak, and redefining it in a test is not supported on Windows. See the error message here: https://reviews.llvm.org/D48446 llvm-svn: 335523
* [ubsan] Add support for reporting diagnostics to a monitor processVedant Kumar2018-06-221-0/+37
| | | | | | | | | | | | | | | | | | Add support to the ubsan runtime for reporting diagnostics to a monitor process (e.g a debugger). The Xcode IDE uses this by setting a breakpoint on __ubsan_on_report and collecting diagnostic information via __ubsan_get_current_report_data, which it then surfaces to users in the editor UI. Testing for this functionality already exists in upstream lldb, here: lldb/packages/Python/lldbsuite/test/functionalities/ubsan Apart from that, this is `ninja check-{a,ub}san` clean. Differential Revision: https://reviews.llvm.org/D48446 llvm-svn: 335371
* [ubsan] Diagnose noreturn functions which return (compiler-rt)Vedant Kumar2017-12-212-3/+23
| | | | | | | | This is paired with the clang change: https://reviews.llvm.org/D40698 Differential Revision: https://reviews.llvm.org/D40700 llvm-svn: 321232
* [ubsan] Test for pass_object_size bounds checksVedant Kumar2017-12-081-0/+16
| | | | llvm-svn: 320129
* sanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does ↵Peter Collingbourne2017-11-102-0/+23
| | | | | | | | | | | | | | not work. If the lookup using RTLD_NEXT failed, the sanitizer runtime library is later in the library search order than the DSO that we are trying to intercept, which means that we cannot intercept this function. We still want the address of the real definition, though, so look it up using RTLD_DEFAULT. Differential Revision: https://reviews.llvm.org/D39779 llvm-svn: 317930
* [ubsan] Add a static runtime on DarwinVedant Kumar2017-10-071-0/+1
| | | | | | | | As a follow-up to r315142, this makes it possible to use ubsan with a static runtime on Darwin. I've also added a new StandaloneStatic testing configuration so the new setup can be tested. llvm-svn: 315143
* [ubsan] Diagnose invalid uses of builtins (compiler-rt)Vedant Kumar2017-07-291-0/+35
| | | | | | Differential Revision: https://reviews.llvm.org/D34591 llvm-svn: 309461
* [ubsan] Improve diagnostics for return value checks (compiler-rt)Vedant Kumar2017-06-232-6/+33
| | | | | | Differential Revision: https://reviews.llvm.org/D34298 llvm-svn: 306164
* [ubsan] Don't enable debug info in all testsReid Kleckner2017-05-151-1/+1
| | | | | | | | | | | Add a lit substitution (I chose %gmlt) so that only stack trace tests get debug info. We need a lit substition so that this expands to -gline-tables-only -gcodeview on Windows. I think in the future we should reconsider the need for -gcodeview from the GCC driver, but for now, this is necessary. llvm-svn: 303083
* [ubsan]: temporarily disable print_stack_trace.cc testAlexander Potapenko2017-05-051-0/+3
| | | | | | | | Some problems with ARM stack unwinding led to inaccurate stack traces being printed, which caused this test to fail on http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh llvm-svn: 302239
* [ubsan] Implement __sanitizer_print_stack_trace for standalone UBSan runtime.Alexander Potapenko2017-05-051-0/+20
| | | | | | Patch by Max Moroz, reviewed at https://reviews.llvm.org/D32542 llvm-svn: 302218
* [ubsan] Fix error summary message for ObjC BOOL invalid loadsVedant Kumar2017-05-051-0/+14
| | | | llvm-svn: 302211
* [ubsan] Fall back to the fast unwinder when print_stacktrace=1Vedant Kumar2017-05-011-5/+2
| | | | | | | | | | | | | | This makes it possible to get stacktrace info when print_stacktrace=1 on Darwin (where the slow unwinder is not currently supported [1]). This should not regress any other platforms. [1] The thread about r300295 has a relatively recent discusion about this. We should be able to enable the existing slow unwind functionality for Darwin, but this needs more testing. Differential Revision: https://reviews.llvm.org/D32517 llvm-svn: 301839
* [ubsan] Make the cast overflow message less redundantVedant Kumar2017-04-271-1/+1
| | | | llvm-svn: 301589
* Make nullability test pass on Windows, which evaluates parameters right-to-left.Nico Weber2017-03-221-2/+0
| | | | llvm-svn: 298539
* [ubsan] Add e2e test for -fsanitize=nullabilityVedant Kumar2017-03-171-0/+64
| | | | llvm-svn: 298117
* [test] Use @LINE macroFilipe Cabecinhas2017-02-231-2/+2
| | | | llvm-svn: 295995
* Merge two coverage tests undef UBSan into one.Evgeniy Stepanov2016-06-151-1/+5
| | | | | | Also replace mkdir -p with rm -rf && mkdir. llvm-svn: 272839
* [sancov] enabling coverage edge pruning by default.Mike Aizatsky2016-04-061-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D18845 llvm-svn: 265614
* [test/ubsan/coverage-levels] Fix file references in UBSAN_OPTIONSFilipe Cabecinhas2016-03-031-5/+5
| | | | llvm-svn: 262632
* Fix the RUN on UBSAN unit testsSumanth Gundapaneni2015-12-011-1/+1
| | | | | | | | | For the build set up which runs the unit tests using an emulator like QEMU, the unit tests must be run using %run. Differential Revision: http://reviews.llvm.org/D15081 llvm-svn: 254467
* Fixup test/ubsan/TestCases/Misc/coverage-levels.cc, LLVM is smarterHal Finkel2015-10-231-1/+1
| | | | | | | | | | Fixing up this test case because LLVM is smarter now, and can better analyze: if ((argc << shift) == 16) in this test case. llvm-svn: 251147
* [compiler-rt] [sanitizer] Clean buildbot failures for aarch64Adhemerval Zanella2015-09-181-2/+2
| | | | | | | | Currently aarch64 lacks instrumentation support for variadic arguments for MSan. This patch sets the UBSan tests that uses it as to require stable-runtime and sets aarch64/ubsan as an unstable one. llvm-svn: 247996
* [MSan] Enable MSAN for aarch64Adhemerval Zanella2015-09-161-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enabled msan for aarch64 with 39-bit VMA and 42-bit VMA. As defined by lib/msan/msan.h the memory layout used is for 39-bit is: 00 0000 0000 - 40 0000 0000: invalid 40 0000 0000 - 43 0000 0000: shadow 43 0000 0000 - 46 0000 0000: origin 46 0000 0000 - 55 0000 0000: invalid 55 0000 0000 - 56 0000 0000: app (low) 56 0000 0000 - 70 0000 0000: invalid 70 0000 0000 - 80 0000 0000: app (high) And for 42-bit VMA: 000 0000 0000 - 100 0000 0000: invalid 100 0000 0000 - 11b 0000 0000: shadow 11b 0000 0000 - 120 0000 0000: invalid 120 0000 0000 - 13b 0000 0000: origin 13b 0000 0000 - 2aa 0000 0000: invalid 2aa 0000 0000 - 2ab 0000 0000: app (low) 2ab 0000 0000 - 3f0 0000 0000: invalid 3f0 0000 0000 - 400 0000 0000: app (high) Most of tests are passing with exception of: * Linux/mallinfo.cc * chained_origin_limits.cc * dlerror.cc * param_tls_limit.cc * signal_stress_test.cc * nonnull-arg.cpp The 'Linux/mallinfo.cc' is due the fact AArch64 returns the sret in 'x8' instead of default first argument 'x1'. So a function prototype that aims to mimic (by using first argument as the return of function) won't work. For GCC one can make a register alias (register var asm ("r8")), but for clang it detects is an unused variable and generate wrong code. The 'chained_origin_limits' is probably due a wrong code generation, since it fails only when origin memory is used (-fsanitize-memory-track-origins=2) and only in the returned code (return buf[50]). The 'signal_streess_test' and 'nonnull-arg' are due currently missing variadic argument handling in memory sanitizer code instrumentation on LLVM side. Both 'dlerror' and 'param_tls_test' are unknown failures that require further investigation. All the failures are XFAIL for aarch64 for now. llvm-svn: 247809
* Mark the log_path ubsan test as requiring a shell. It uses globs.Reid Kleckner2015-09-011-0/+3
| | | | llvm-svn: 246566
* [UBSan] Test churn: use the approach from r244839 and r245962 in UBSan lit ↵Alexey Samsonov2015-08-254-10/+9
| | | | | | | | | | | tests. Introduce %env_ubsan_opts= substitution instead of specifying UBSAN_OPTIONS manually in the RUN-lines. This will come in handy once we introduce some default UBSAN_OPTIONS for the whole testsuite (for instance, make abort_on_error common option). llvm-svn: 245967
* [UBSan] Add the ability to print more precise error kind in summary line.Alexey Samsonov2015-08-241-2/+5
| | | | | | | | | | Reviewers: rsmith, pcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12215 llvm-svn: 245897
* [windows] Always use the lit shell on Windows, even if bash is presentReid Kleckner2015-08-121-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: This is consistent with LLVM and Clang. The lit shell isn't a complete bash implementation, but its behavior is more easily reproducible. This fixes some ubsan test failures. One ubsan test requires a shell currently, so I added "REQUIRES: shell", and the other doesn't work on Windows because it prints a stack trace and uses a linker that doesn't support DWARF. We can fix it eventually through other means. Reviewers: samsonov, pcc Subscribers: yaron.keren, filcab, llvm-commits Differential Revision: http://reviews.llvm.org/D11960 llvm-svn: 244837
* [UBSan] Test: Move coverage-levels.cc out of Linux directoryFilipe Cabecinhas2015-07-311-0/+0
| | | | | | | | | | | | | Summary: This test is working on other platforms. Reviewers: samsonov, emaste Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10415 llvm-svn: 243771
* UBSan: Enable runtime library tests on Windows, and get most tests passing.Peter Collingbourne2015-07-024-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically: - Disable int128 tests on Windows, as MSVC cl.exe does not support int128, so we might not have been able to build the runtime with int128 support. - XFAIL the vptr tests as we lack Microsoft ABI support. - XFAIL enum.cpp as UBSan fails to add the correct instrumentation code for some reason. - Modify certain tests that build executables multiple times to use unique names for each executable. This works around a race condition observed on Windows. - Implement IsAccessibleMemoryRange for Windows to fix the last misaligned.cpp test. - Introduce a substitution for testing crashes on Windows using KillTheDoctor. Differential Revision: http://reviews.llvm.org/D10864 llvm-svn: 241303
* [SanitizerCoverage] Upgrade lit tests to new -fsanitize-coverage= flags.Alexey Samsonov2015-05-071-5/+5
| | | | llvm-svn: 236796
* [UBSan] Make stacktrace-matching CHECK-lines in tests Linux-specific.Alexey Samsonov2015-04-301-4/+2
| | | | | | | Darwin doesn't yet allow to print stack trace, as it lacks the slow unwinder. This is one more attempt to fix vptr.cpp on Mac OS X. llvm-svn: 236195
* [UBSan] Add a testcase for __ubsan_default_options() function.Alexey Samsonov2015-04-291-0/+18
| | | | llvm-svn: 236151
* Allow UBSan+MSan and UBSan+TSan combinations (Clang part).Alexey Samsonov2015-04-282-2/+5
| | | | | | | | Embed UBSan runtime into TSan and MSan runtimes in the same as we do in ASan. Extend UBSan test suite to also run tests for these combinations. llvm-svn: 235954
* Make ubsan respect log_pathHal Finkel2015-04-191-0/+33
| | | | | | | As with the other sanitizers, it is desirable to allow ubsan's output to be redirected to somewhere other than stderr (and into per-process log files). llvm-svn: 235277
* [UBSan] Embed UBSan into ASan runtime (compiler-rt part).Alexey Samsonov2015-04-011-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Change the way we use ASan and UBSan together. Instead of keeping two separate runtimes (libclang_rt.asan and libclang_rt.ubsan), embed UBSan into ASan and get rid of libclang_rt.ubsan. If UBSan is not supported on a platform, all UBSan sources are just compiled into dummy empty object files. UBSan initialization code (e.g. flag parsing) is directly called from ASan initialization, so we are able to enforce correct initialization order. This mirrors the approach we already use for ASan+LSan. This change doesn't modify the way we use standalone UBSan. Test Plan: regression test suite Reviewers: kubabrecka, zaks.anna, rsmith, kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D8646 llvm-svn: 233861
* Make the UBSan coverage-levels.cc test be Linux specificKuba Brecka2015-03-122-2/+9
| | | | | | Reviewed at http://reviews.llvm.org/D8278 llvm-svn: 232025
* Revert "[UBSan] Add testcases for -fsanitize=shift-base and ↵Alexey Samsonov2015-03-051-1/+1
| | | | | | | | -fsanitize=shift-exponent." The test case fails on AArch64. llvm-svn: 231410
OpenPOWER on IntegriCloud