summaryrefslogtreecommitdiff
path: root/test/ubsan/TestCases/TypeCheck/vptr.cpp
AgeCommit message (Collapse)Author
2017-12-28-fsanitize=vptr warnings on bad static types in dynamic_cast and typeidStephan Bergmann
...when such an operation is done on an object during con-/destruction. (This adds a test case to compiler-rt/test/ubsan/TestCases/TypeCheck/vptr.cpp that, unlike the existing test cases there, wants to detect multiple UBSan warnings in one go. Therefore, that file had to be changed from globally using -fno-sanitize-recover to individually using halt_on_error only where appropriate.) This is the compiler-rt part of a patch covering both cfe and compiler-rt. Differential Revision: https://reviews.llvm.org/D40295 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@321518 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[ubsan] Disable one test on Android.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315220 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-15ubsan: Unbreak ubsan_cxx runtime library on Windows.Peter Collingbourne
This was originally broken by r258744 which introduced a weak reference from ubsan to ubsan_cxx. This reference does not work directly on Windows because COFF has no direct concept of weak symbols. The fix is to use /alternatename to create a weak external reference to ubsan_cxx. Also fix the definition (and the name, so that we drop cached values) of the cmake flag that controls whether to build ubsan_cxx. Now the user-controllable flag is always on, and we turn it off internally depending on whether we support building it. Differential Revision: https://reviews.llvm.org/D37882 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313391 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-25[ubsan] -fsanitize=vptr now requires -fsanitize=null, update testsVedant Kumar
See: https://bugs.llvm.org/show_bug.cgi?id=33881 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309008 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-26[ubsan] Fix vptr.cpp test to be more resilient. NFC.Robert Lougher
The test contains a switch statement in which two of the cases are tail-merged, with the call to __ubsan_handle_dynamic_type_cache_miss_abort in the common tail. When tail-merging occurs, the debug location of the tail is randomly taken from one of the merge inputs. Luckily for the test, the expected line number in the check is the one which is chosen by the tail-merge. However, if the switch cases are re-ordered the test will fail. This patch disables tail-merge, making the test resilient to changes in tail-merge, and unblocking review D25742. It does not change the semantics of the test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@285208 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-24[ubsan] fix the test to me more resistent against changes in the sanitizer ↵Kostya Serebryany
allocator git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@279661 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25Fix columns for member function callsHal Finkel
After r270775, Clang is smarter about the generating the locations for member-function calls. Update some ubsan tests accordingly. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270801 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-06-25[CMake] Fix PR23539: Don't reference C++ ABI symbols prior to Mac OS 10.9.Alexey Samsonov
Summary: This patch implements step 1 from https://llvm.org/bugs/show_bug.cgi?id=23539#c10 I'd appreciate if you could test it on Mac OS and verify that parts of UBSan runtime that reference C++ ABI symbols are properly excluded, and fix ASan/UBSan builds. Test Plan: regression test suite Reviewers: thakis, hans Subscribers: llvm-commits, zaks.anna, kubabrecka Differential Revision: http://reviews.llvm.org/D10621 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@240617 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] Disable vptr.cpp on Darwin again.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236165 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29[UBSan] Various improvements to vptr.cpp test caseAlexey Samsonov
* Remove __ubsan_default_options, so that test would work on Darwin * Fix unintentional undefined behavior in the code (missing return) * Build the test with -fno-sanitize-recover to distinguish expected failures and expected passes by return code. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236152 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-29Re-XFAIL UBSan vptr testcase on darwin.Ahmed Bougacha
Partial revert of r235961; the test still fails on Green Dragon bots. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@236135 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-28Address old FIXMEs in UBSan test cases.Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@235961 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-02-26[UBSan] Run all UBSan tests in 32-bit mode as well.Alexey Samsonov
We build and support UBSan on 32-bit platforms. We should run tests there as well. Fixes PR22683. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@230662 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-20[Sanitizer] Refactor SuppressionContext class.Alexey Samsonov
SuppressionContext is no longer a singleton, shared by all sanitizers, but a regular class. Each of ASan, LSan, UBSan and TSan now have their own SuppressionContext, which only parses suppressions specific to that sanitizer. "suppressions" flag is moved away from common flags into tool-specific flags, so the user now may pass ASAN_OPTIONS=suppressions=asan_supp.txt LSAN_OPIONS=suppressions=lsan_supp.txt in a single invocation. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@230026 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13Add -frtti to tests that need rttiFilipe Cabecinhas
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@229184 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15[sanitizer] Flag parser rewrite.Evgeniy Stepanov
The new parser is a lot stricter about syntax, reports unrecognized flags, and will make it easier to implemented some of the planned features. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226169 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-30Revert "UBSan: Teach isDerivedFromAtOffset and findBaseAtOffset about vbases"Alexey Samsonov
This reverts commit r221445. This change leads to false positives reports from -fsanitize=vptr. See original commit thread for more details. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224972 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18Fix suppressions file usageFilipe Cabecinhas
Summary: Always quote suppressions files given to *_OPTIONS. This will make it not break when given full Windows paths (otherwise, parsing would stop after the drive's letter + ':'). Also fix one or two cases where the suppression files' extensions were not *.supp. Reviewers: samsonov, kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6680 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@224529 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-06UBSan: Teach isDerivedFromAtOffset and findBaseAtOffset about vbasesDavid Majnemer
When the __virtual_mask is set, __offset_flags >> __offset_shift yields an offset into the vtable. Dereferencing this vtable slot gets us the vbase offset. Adjust a test case to verify that this, in fact, works. Differential Revision: http://reviews.llvm.org/D6074 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@221445 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16Adds stable-runtime to ubsan to avoid broken ARM tests with asanRenato Golin
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@219906 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14Re-enable ASAN/UBSAN tests on ARM, with VFP3 they began to passRenato Golin
When compiling with -mfpu=vfpv3, those tests began to pass, like the others with "Illegal Instruction" error, so removing the XFAIL from them should get the bot green (and have more tests!). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@219721 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-09XFAIL some more sanitiser ARMv7l testsRenato Golin
Some more tests failing on the ARMv7 buildbot. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@219404 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19[UBSan] Introduce more flexible __ubsan_default_options function instead of ↵Alexey Samsonov
UBSAN_DEFAULT_OPTIONS compile definition git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@218137 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12Revert r217616. Problems and complexity it introduces negate its benefitAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217652 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-11[UBSan] Parse common flags from UBSAN_OPTIONS runtime variable even ifAlexey Samsonov
UBSan is combined with ASan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217616 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-10[UBSan] Add halt_on_error runtime flagAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217535 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-05The test doesn't export ASAN_OPTIONS, so $ASAN_OPTIONS should not be used in ↵Alexander Kornienko
RUN lines. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214855 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-05[UBSan] Allow to suppress reports from vptr checker for specified types.Alexey Samsonov
Based on http://reviews.llvm.org/D4702 by Byoungyoung Lee! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214833 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-07-23[UBSan] Add the ability to dump call stacks to -fsanitize=vptrAlexey Samsonov
This change introduces the first UBSan-specific runtime flag: print_stacktrace (off by default). It can be set in UBSAN_OPTIONS to unwind and print call stacks in addition to diagnostic messages. For now these stacks are printed only in vptr checker. This change is based on http://reviews.llvm.org/D4410 by Byoungyoung Lee! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@213783 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-20[ubsan] fix vptr test on ARMGreg Fitzgerald
Differential Revision: http://reviews.llvm.org/D3751 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209249 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-30Add %run to all lit testsGreg Fitzgerald
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@207709 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-22[asan] enable LeakSanitizer (LSan) by default in asan. This only affects ↵Kostya Serebryany
Linux x86_64. LSan has been used in various projects for more than half a year and we now consider it quite stable to be on by default. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206896 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-14Move UBSan test suite under test/Alexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201401 91177308-0d34-0410-b5e6-96231b3b80d8