summaryrefslogtreecommitdiff
path: root/test/ubsan
AgeCommit message (Collapse)Author
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-12-01[ubsan] Re-commit: lit changes for lld testing, future lto testing.Roman Lebedev
Summary: As discussed in https://github.com/google/oss-fuzz/issues/933, it would be really awesome to be able to use ThinLTO for fuzzing. However, as @kcc has pointed out, it is currently undefined (untested) whether the sanitizers actually function properly with LLD and/or LTO. This patch is inspired by the cfi test, which already do test with LTO (and/or LLD), since LTO is required for CFI to function. I started with UBSan, because it's cmakelists / lit.* files appeared to be the cleanest. This patch adds the infrastructure to easily add LLD and/or LTO sub-variants of the existing lit test configurations. Also, this patch adds the LLD flavor, that explicitly does use LLD to link. The check-ubsan does pass on my machine. And to minimize the [initial] potential buildbot breakage i have put some restrictions on this flavour. Please review carefully, i have not worked with lit/sanitizer tests before. The original attempt, r319525 was reverted in r319526 due to the failures in compiler-rt standalone builds. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc Differential Revision: https://reviews.llvm.org/D39508 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319575 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01Revert "[ubsan] lit changes for lld testing, future lto testing."Roman Lebedev
This reverts commit r319525. This change has introduced a problem with the Lit tests build for compiler-rt using Gold: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/6047/steps/test%20standalone%20compiler-rt/logs/stdio llvm-lit: /b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py:101: fatal: unable to parse config file '/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg', traceback: Traceback (most recent call last): File "/b/sanitizer-x86_64-linux/build/llvm/utils/lit/lit/TestingConfig.py", line 88, in load_from_path exec(compile(data, path, 'exec'), cfg_globals, None) File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 37, in <module> if root.host_os not in ['Linux'] or not is_gold_linker_available(): File "/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Linux/lit.local.cfg", line 27, in is_gold_linker_available stderr = subprocess.PIPE) File "/usr/lib/python2.7/subprocess.py", line 390, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319529 91177308-0d34-0410-b5e6-96231b3b80d8
2017-12-01[ubsan] lit changes for lld testing, future lto testing.Roman Lebedev
Summary: As discussed in https://github.com/google/oss-fuzz/issues/933, it would be really awesome to be able to use ThinLTO for fuzzing. However, as @kcc has pointed out, it is currently undefined (untested) whether the sanitizers actually function properly with LLD and/or LTO. This patch is inspired by the cfi test, which already do test with LTO (and/or LLD), since LTO is required for CFI to function. I started with UBSan, because it's cmakelists / lit.* files appeared to be the cleanest. This patch adds the infrastructure to easily add LLD and/or LTO sub-variants of the existing lit test configurations. Also, this patch adds the LLD flavor, that explicitly does use LLD to link. The check-ubsan does pass on my machine. And to minimize the [initial] potential buildbot breakage i have put some restrictions on this flavour. Please review carefully, i have not worked with lit/sanitizer tests before. Reviewers: eugenis, vitalybuka Reviewed By: eugenis Subscribers: #sanitizers, pcc, kubamracek, mgorny, llvm-commits, mehdi_amini, inglorion, kcc Differential Revision: https://reviews.llvm.org/D39508 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319525 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-10Factor out "stable-runtime" feature and enable it on all android.Evgeniy Stepanov
This is a very poorly named feature. I think originally it meant to cover linux only, but the use of it in msan seems to be about any aarch64 platform. Anyway, this change should be NFC on everything except Android. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315389 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-10XFAIL ubsan/TestCases/TypeCheck/Function/function.cpp on WindowsHans Wennborg
I think it got accidentally enabled in r315105 or thereabouts. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315374 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-09[ubsan] Fix Asan internal alloc corruption in PR33221 test.Evgeniy Stepanov
MAP_FIXED discards the existing mapping at the given address. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315247 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-10-07cmake: Fix one more usage of append()Vedant Kumar
append() isn't available with some cmake versions, so I need to use a different construct. I missed this case in r315144. http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/39355 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315157 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-10-06Factor out default_(a|ub)sanitizer_opts in lit.Evgeniy Stepanov
Reviewers: vitalybuka Subscribers: srhines, llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D38644 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315106 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-06[sanitizer] Test ubsan and cfi on android.Evgeniy Stepanov
Summary: Enable check-cfi and check-ubsan on Android. Check-ubsan includes standalone and ubsan+asan, but not tsan or msan. Cross-dso cfi tests are disabled for now. Reviewers: vitalybuka, pcc Subscribers: srhines, kubamracek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D38608 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-05[sanitizer] Move %ld_flags_rpath_exe to common and use it in more tests.Evgeniy Stepanov
Reviewers: vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D38527 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315010 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-09-13[ubsan] Enable -fsanitize=function test on DarwinVedant Kumar
Differential Revision: https://reviews.llvm.org/D37598 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313097 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-08Enable ubsan on NetBSDKamil Rytarowski
Summary: Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, kcc, filcab, fjricci Reviewed By: fjricci Subscribers: srhines, kubamracek, mgorny, llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36483 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@310412 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-02[ubsan] Test -fsanitize=vptr without -fsanitize=nullVedant Kumar
This reverts commit r309042, thereby adding a test for -fsanitize=vptr functionality without -fsanitize=null. It also removes -fsanitize=null from another -fsanitize=vptr test. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309847 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-07-25[ubsan] Update a test missed in r309008, NFCVedant Kumar
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309042 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
2017-07-13[ubsan] Teach the pointer overflow check that "p - <unsigned> <= p" ↵Vedant Kumar
(compiler-rt) Compiler-rt changes associated with: D34121 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307956 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-06-15[ubsan] Fix a faulty memory accessibility checkVedant Kumar
The dynamic type check needs to inspect vtables, but could crash if it encounters a vtable pointer to inaccessible memory. In the first attempt to fix the issue (r304437), we performed a memory accessibility check on the wrong range of memory. This should *really* fix the problem. Patch by Max Moroz! Differential Revision: https://reviews.llvm.org/D34215 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305489 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-12[ubsan] Detect invalid unsigned pointer index expression (compiler-rt)Vedant Kumar
Compiler-rt part of: https://reviews.llvm.org/D33910 Differential Revision: https://reviews.llvm.org/D33911 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305217 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-01[ubsan] Runtime support for pointer overflow checkingVedant Kumar
Patch by John Regehr and Will Dietz! Differential Revision: https://reviews.llvm.org/D20323 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304461 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-01Tighten up test to address bot failure. NFC.Vedant Kumar
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/32035 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304440 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-01Bug 33221 [UBSAN] segfault with -fsanitize=undefinedVedant Kumar
There is can be a situation when vptr is not initializing by constructor of the object, and has a junk data which should be properly checked, because c++ standard says: "if default constructor is not specified 16 (7.3) no initialization is performed." Patch by Denis Khalikov! Differential Revision: https://reviews.llvm.org/D33712 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@304437 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-24Fix negate-overflow.cpp test on Windows after r303440Hans Wennborg
lit would interpret the exit code as failuire. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303809 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-12[ubsan] Enable debug info in test binariesReid Kleckner
This fixes tests that use debug info to check ubsan stack traces. One was XFAILd on Windows and the other was actively failing for weeks. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302924 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-09[SystemZ] Fix failures after D32542Ulrich Weigand
This commit made ubsan use the fast unwinder. On SystemZ this requires test cases to be compiled with -mbackchain. That was already done for asan, but not ubsan. Add the flag for ubsan as well. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302562 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-04-14[ubsan] Use the correct tool name in diagnosticsVedant Kumar
When using ASan and UBSan together, the common sanitizer tool name is set to "AddressSanitizer". That means that when a UBSan diagnostic is printed out, it looks like this: SUMMARY: AddressSanitizer: ... This can confuse users. Fix it so that we always use the correct tool name when printing out UBSan diagnostics. Differential Revision: https://reviews.llvm.org/D32066 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300358 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-11-29[sanitizer] Add macOS minimum deployment target to all compiler invocations ↵Kuba Mracek
in lit tests The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden). Differential Revision: https://reviews.llvm.org/D26929 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@288186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-21Add a test for vcall on a null ptr.Ivan Krasin
Summary: Turns out that in the case of -fsanitize=null and a virtual call, the type check was generated *after* reading from vtable, which causes a non-interpretable segfault. The check has been moved up in https://reviews.llvm.org/D26559 and this CL adds a test for this case. Reviewers: pcc Subscribers: cfe-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D26560 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@287578 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-07-11[compiler-rt] Fix VisualStudio virtual folders layoutEtienne Bergeron
Summary: This patch is a refactoring of the way cmake 'targets' are grouped. It won't affect non-UI cmake-generators. Clang/LLVM are using a structured way to group targets which ease navigation through Visual Studio UI. The Compiler-RT projects differ from the way Clang/LLVM are grouping targets. This patch doesn't contain behavior changes. Reviewers: kubabrecka, rnk Subscribers: wang0109, llvm-commits, kubabrecka, chrisha Differential Revision: http://reviews.llvm.org/D21952 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@275111 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-06-14Fix ubsan/coverage test to put coverage file in a subdirectory.Evgeniy Stepanov
By default coverage is dumped to the current directory, which may not always be writable. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272732 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-14Compiler-rt test for sanitizer coverage w/o sanitizers.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@272718 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-02UBSan: crash less often on corrupted Vtables.Ivan Krasin
Summary: This CL adds a weak check for a Vtable prefix: for a well-formed Vtable, we require the prefix to be within [-1<<20; 1<<20]. Practically, this solves most of the known cases when UBSan segfaults without providing any useful diagnostics. Reviewers: pcc Subscribers: kubabrecka Differential Revision: http://reviews.llvm.org/D19750 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271560 91177308-0d34-0410-b5e6-96231b3b80d8