summaryrefslogtreecommitdiff
path: root/test/ubsan/TestCases/Misc
AgeCommit message (Collapse)Author
2017-12-21[ubsan] Diagnose noreturn functions which return (compiler-rt)Vedant Kumar
This is paired with the clang change: https://reviews.llvm.org/D40698 Differential Revision: https://reviews.llvm.org/D40700 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321232 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-08[ubsan] Test for pass_object_size bounds checksVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320129 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-10sanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does ↵Peter Collingbourne
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317930 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-07[ubsan] Add a static runtime on DarwinVedant Kumar
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315143 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-29[ubsan] Diagnose invalid uses of builtins (compiler-rt)Vedant Kumar
Differential Revision: https://reviews.llvm.org/D34591 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-23[ubsan] Improve diagnostics for return value checks (compiler-rt)Vedant Kumar
Differential Revision: https://reviews.llvm.org/D34298 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306164 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15[ubsan] Don't enable debug info in all testsReid Kleckner
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303083 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-05[ubsan]: temporarily disable print_stack_trace.cc testAlexander Potapenko
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302239 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-05[ubsan] Implement __sanitizer_print_stack_trace for standalone UBSan runtime.Alexander Potapenko
Patch by Max Moroz, reviewed at https://reviews.llvm.org/D32542 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302218 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-05[ubsan] Fix error summary message for ObjC BOOL invalid loadsVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302211 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01[ubsan] Fall back to the fast unwinder when print_stacktrace=1Vedant Kumar
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-27[ubsan] Make the cast overflow message less redundantVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301589 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22Make nullability test pass on Windows, which evaluates parameters right-to-left.Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298539 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17[ubsan] Add e2e test for -fsanitize=nullabilityVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298117 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-23[test] Use @LINE macroFilipe Cabecinhas
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@295995 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-15Merge two coverage tests undef UBSan into one.Evgeniy Stepanov
Also replace mkdir -p with rm -rf && mkdir. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-06[sancov] enabling coverage edge pruning by default.Mike Aizatsky
Differential Revision: http://reviews.llvm.org/D18845 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@265614 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-03[test/ubsan/coverage-levels] Fix file references in UBSAN_OPTIONSFilipe Cabecinhas
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@262632 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-01Fix the RUN on UBSAN unit testsSumanth Gundapaneni
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254467 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-23Fixup test/ubsan/TestCases/Misc/coverage-levels.cc, LLVM is smarterHal Finkel
Fixing up this test case because LLVM is smarter now, and can better analyze: if ((argc << shift) == 16) in this test case. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@251147 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-18[compiler-rt] [sanitizer] Clean buildbot failures for aarch64Adhemerval Zanella
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@247996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16[MSan] Enable MSAN for aarch64Adhemerval Zanella
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@247809 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01Mark the log_path ubsan test as requiring a shell. It uses globs.Reid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@246566 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25[UBSan] Test churn: use the approach from r244839 and r245962 in UBSan lit ↵Alexey Samsonov
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). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245967 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-24[UBSan] Add the ability to print more precise error kind in summary line.Alexey Samsonov
Reviewers: rsmith, pcc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D12215 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@245897 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-12[windows] Always use the lit shell on Windows, even if bash is presentReid Kleckner
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@244837 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31[UBSan] Test: Move coverage-levels.cc out of Linux directoryFilipe Cabecinhas
Summary: This test is working on other platforms. Reviewers: samsonov, emaste Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10415 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@243771 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-02UBSan: Enable runtime library tests on Windows, and get most tests passing.Peter Collingbourne
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@241303 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-07[SanitizerCoverage] Upgrade lit tests to new -fsanitize-coverage= flags.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236796 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-30[UBSan] Make stacktrace-matching CHECK-lines in tests Linux-specific.Alexey Samsonov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236195 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29[UBSan] Add a testcase for __ubsan_default_options() function.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236151 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28Allow UBSan+MSan and UBSan+TSan combinations (Clang part).Alexey Samsonov
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@235954 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-19Make ubsan respect log_pathHal Finkel
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). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@235277 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-01[UBSan] Embed UBSan into ASan runtime (compiler-rt part).Alexey Samsonov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@233861 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-12Make the UBSan coverage-levels.cc test be Linux specificKuba Brecka
Reviewed at http://reviews.llvm.org/D8278 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@232025 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-05Revert "[UBSan] Add testcases for -fsanitize=shift-base and ↵Alexey Samsonov
-fsanitize=shift-exponent." The test case fails on AArch64. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231410 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231151 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-12Update test cases for new -fsanitize-recover= semantics.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225725 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06[ubsan] disable coverage-levels.cc on darwin until we can investigate what's ↵Kostya Serebryany
wrong there. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225281 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06[ubsan] partially enable -fsanitize-coverage=N with ubsan. It will work as ↵Kostya Serebryany
usual in most cases but will not dump coverage on error with -fno-sanitize-recover (that'll be a separate fix) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225234 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-10[Ubsan] Fix the missing_return.cpp test to pass on FreeBSDViktor Kutuzov
Differential Revision: http://reviews.llvm.org/D6088 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221597 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10Disabling main() check on UBSAN, since the noreturn check is already madeRenato Golin
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@219488 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-08Report source location of returns_nonnull attribute in UBSan reports.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217400 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-08Implement nonnull-attribute sanitizerAlexey Samsonov
Summary: This patch implements a new UBSan check, which verifies that function arguments declared to be nonnull with __attribute__((nonnull)) are actually nonnull in runtime. To implement this check, we pass FunctionDecl to CodeGenFunction::EmitCallArgs (where applicable) and if function declaration has nonnull attribute specified for a certain formal parameter, we compare the corresponding RValue to null as soon as it's calculated. Test Plan: regression test suite Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits, rnk Differential Revision: http://reviews.llvm.org/D5082 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217389 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-28[ubsan] Follow-up for r216657: fixed the line numbers in the test.Alexander Potapenko
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216661 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-28[UBSan] Temporarily disable checks for stack traces in UBSan reports on DarwinAlexander Potapenko
to make the tests green. Slow stack unwinding is disabled in libsanitizer on Darwin now. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216657 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-22[UBSan] Add support for printing backtraces to all UBSan handlersAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@216289 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13[UBSan] Add returns-nonnull sanitizer.Alexey Samsonov
Summary: This patch adds a runtime check verifying that functions annotated with "returns_nonnull" attribute do in fact return nonnull pointers. It is based on suggestion by Jakub Jelinek: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140623/223693.html. Test Plan: regression test suite Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4849 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215485 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-29[UBSan] Try to enable pipefail in UBSan lit tests to make them behave more ↵Alexey Samsonov
predictably git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214149 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-14Add %run to tests that used %T/name.exeGreg Fitzgerald
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208744 91177308-0d34-0410-b5e6-96231b3b80d8