summaryrefslogtreecommitdiff
path: root/test/cfi
AgeCommit message (Collapse)Author
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-17Enable PDB generation with lld in asan and cfi tests on Windows.Peter Collingbourne
PDB emission now works well enough that we can rely on it for these tests to pass. Differential Revision: https://reviews.llvm.org/D40188 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318546 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-16[cfi] Test cross-dso CFI on Android.Evgeniy Stepanov
Reviewers: vitalybuka, pcc Subscribers: llvm-commits, srhines Differential Revision: https://reviews.llvm.org/D38911 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315922 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13[cfi] Use %ld_flags_rpath_* substitutions in tests (NFC)Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315775 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-13LowerTypeTests: Give imported symbols a type with size 0 so that they are ↵Peter Collingbourne
not assumed not to alias. It is possible for both a base and a derived class to be satisfied with a unique vtable. If a program contains casts of the same pointer to both of those types, the CFI checks will be lowered to this (with ThinLTO): if (p != &__typeid_base_global_addr) trap(); if (p != &__typeid_derived_global_addr) trap(); The optimizer may then use the first condition combined with the assumption that __typeid_base_global_addr and __typeid_derived_global_addr may not alias to optimize away the second comparison, resulting in an unconditional trap. This patch fixes the bug by giving imported globals the type [0 x i8]*, which prevents the optimizer from assuming that they do not alias. Differential Revision: https://reviews.llvm.org/D38873 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315753 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[cfi] Disable tests with lld on i386.Evgeniy Stepanov
bin/ld.lld: error: ubsan_handlers.cc:(.debug_info+0x80D5D): has non-ABS reloc Bug pending. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315027 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-10-05[cfi] Mark a test as unsupported on darwin.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315007 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-05[cfi] Test on all available targets.Evgeniy Stepanov
Summary: Run CFI tests on all targets current toolchain can target. On multiarch Linux, this will run all CFI tests with -m32 and -m64. Reviewers: pcc Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D38572 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@315001 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-02Use %run for running CFI testsFilipe Cabecinhas
Reviewers: pcc, krasin, eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38412 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@314659 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-15cfi: Enable ThinLTO tests on Windows.Peter Collingbourne
We now avoid using absolute symbols on Windows (D37407 and D37408), so this should work. Fixes PR32770. Differential Revision: https://reviews.llvm.org/D37883 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@313379 91177308-0d34-0410-b5e6-96231b3b80d8
2017-08-25[cfi] only add cfi tests on supported arches.Sean Fertile
Differential Revision: https://reviews.llvm.org/D35101 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@311745 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-01fix trivial typo; NFCHiroshi Inoue
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@306955 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-16[cfi] Enable icall tests with thinlto.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305534 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24[cfi] Fix wrong CMake condition for WIN32.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301257 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24[cfi] Disable ThinLTO + CFI tests on Windows.Evgeniy Stepanov
PR32770. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301235 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22[cfi] Disable thinlto tests on Darwin.Ahmed Bougacha
These were added in r301016, but they're failing, because -fsanitize=cfi seemingly causes -flto=thin to emit raw bitcode objects, rather than the mach-o-wrapped bitcode we emit with -flto=thin alone. That causes all tests to fail with ld64 errors. Filed PR32741. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301065 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21[cfi] Replace elif with elseif in cmake.Evgeniy Stepanov
Apparently, elif() is deprecated. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301022 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21[cfi] Run tests with and without lld and thinlto.Evgeniy Stepanov
Run tests in all configurations: (standalone, with devirtualization) * (gold, lld) * (lto, thinlto) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@301016 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20[cfi] Add explicit -flto in create-derivers test.Evgeniy Stepanov
This is necessary to run the test suite in ThinLTO mode - otherwise opt complains about an input file containing several modules. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300901 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-20[cfi] Move one test under cross-dso/icall.Evgeniy Stepanov
The test is using indirect calls. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@300900 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-25Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.Evgeniy Stepanov
Only depend on LLD if it is going to be built. Re-land of r298174 which got reverted in r298287. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298753 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22Use lld-link /nopdb to suppress PDB generation when DWARF is requiredReid Kleckner
Fixes cfi/stats.cpp and asan/fuse-lld.cc on Windows. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298545 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-22XFAIL CFI stats test while LLD produces corrupt PDBs that confuse DIAReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298476 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-20Revert r298174, r298173, r298169, r298159.Evgeniy Stepanov
Revert "Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF." Revert "[asan] Remove gc-sections test with bfd." Revert "[asan] Disable globals-gc test with ld.bfd." Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)" OOM in gold linker. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298287 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.Evgeniy Stepanov
Only depend on LLD if it is going to be built. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298174 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14[cfi] Disable bad-split test on win32.Evgeniy Stepanov
It appears that the fix only helped Itanium ABI. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297775 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-14[cfi] Add test for type metadata split issue.Evgeniy Stepanov
https://reviews.llvm.org/D30716 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@297771 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14[cfi] Mark tests as xfailing on DarwinVedant Kumar
This allows them to be run on other platforms, undoing damage from r286902. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286904 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14[cfi] Mark some tests as requiring additional support from the MachO writerVedant Kumar
These tests need to be marked as unsupported on Darwin: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/1545 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11[cfi] Test case for weak symbol handling.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286637 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-11[cfi] Tweak a test for the cfi-icall change.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@286612 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-22cfi: Fixes for check-cfi when configured as an external project.Peter Collingbourne
Differential Revision: https://reviews.llvm.org/D24817 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-21Remove obsolete XFAIL.Nico Weber
The sanitizer-windows bot is currently red because this test unexpectedly passes. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282095 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-20XFAIL cfi/stats.cpp on Windows until we fix LLDReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@282018 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-01Un-XFAIL cfi/stats.cpp, it passes since fixing llvm-symbolizer to look for ↵Reid Kleckner
dwarf again git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280422 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-30XFAIL cfi/stats.cpp on Windows until we fix our DIA usageReid Kleckner
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@280106 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-12Add compiler-rt side test for no_sanitize("cfi") attributeIvan Krasin
Summary: Add a test case for __attribute__((no_sanitize("cfi"))) being effective. Reviewers: kcc Subscribers: dberris Differential Revision: https://reviews.llvm.org/D23425 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@278530 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05Reverting r277632 as it breaks the build on MacOS.Ivan Krasin
Reviewers: kcc Differential Revision: https://reviews.llvm.org/D23190 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277798 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-05CFI: add XFAIL test for a future optimization of two vcalls.Ivan Krasin
Summary: Often, a code will call multiple virtual methods of a given object. If they go in a linear block, it should be possible to check vtable before the first call, then store vtable pointer and reuse it for the second vcall without any additional checks. This is expected to have a positive performance impact on a hot path in Blink, see https://crbug.com/634139. Reviewers: kcc Differential Revision: https://reviews.llvm.org/D23151 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277795 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03Add CFI tests for -lowertypetests-bitsets-level.Ivan Krasin
Summary: -lowertypetests-bitsets-level controls which kinds of bitsets are generated, as introduced in r277556. This change adds tests to compiler-rt. Reviewers: kcc Differential Revision: https://reviews.llvm.org/D23103 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@277632 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-25cfi: Start testing CFI in both standalone and devirtualization modes.Peter Collingbourne
Differential Revision: http://reviews.llvm.org/D21123 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273758 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24cfi: Apply pass rename to tests.Peter Collingbourne
Differential Revision: http://reviews.llvm.org/D21055 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@273731 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-28Update visibility flags for CFI tests.Peter Collingbourne
Differential Revision: http://reviews.llvm.org/D18813 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@267902 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16Replace hardcoded comment at 'lit.site.cfg.in'Alex Denisov
At the moment almost every lit.site.cfg.in contains two lines comment: ## Autogenerated by LLVM/Clang configuration. # Do not edit! The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from configure_lit_site_cfg with the note and some useful information. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@266520 91177308-0d34-0410-b5e6-96231b3b80d8