Commit Graph

75 Commits

Author SHA1 Message Date
Petr Hosek 61b513351c [CMake] Avoid internal dependencies in the runtimes build
When performing runtimes build, dependencies like clang and
clang-headers aren't available. This was accidentally omitted in D57992.

llvm-svn: 353796
2019-02-12 04:13:58 +00:00
Stefan Granitz 6163039ce0 [CMake] Quick-Fix FileCheck target does not exist when building against LLVM install-tree with COMPILER_RT_INCLUDE_TESTS=ON
The issue came up during release testing for LLVM 8: https://bugs.llvm.org/show_bug.cgi?id=40443

Differential Revision: https://reviews.llvm.org/D57224

llvm-svn: 352381
2019-01-28 16:14:57 +00:00
Stefan Granitz 8c026e44cf [CMake] Fix standalone build after LLVM exports utility targets
LLVM started exporting targets for utilites with https://reviews.llvm.org/rL350959, which broke compiler-rt standalone builds because it was used to define FileCheck manually.
Changed this, so FileCheck gets imported now.

llvm-svn: 350973
2019-01-11 21:59:58 +00:00
Matt Morehouse 24568789c4 [libFuzzer] Enable tests on Windows
Summary:
Enable tests on Windows and make check-fuzzer pass on it.  Make
check-fuzzer pass on Windows by fixing libFuzzer, fixing tests, and by
disabling tests on Windows. Most of these are disabled temporarily as
support for the tests and the features they test will be added
incrementally.  Other tests will not be enabled since they require
things that are not on Windows (eg: afl_driver tests).  Every test
that was explicitly disabled on Windows has a comment explaining why
(unless obvious like merge-posix.test).

The lit.cfg file was modified to support running tests on windows.
fuzzer-dirs.test was fixed by making the Windows implementation print
the same error message as the posix version.
merge-control-file.test was fixed by making the test binary end with
the ".exe" extension (on all platforms).

Patch By: metzman

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: srhines, mgorny

Differential Revision: https://reviews.llvm.org/D51549

llvm-svn: 341385
2018-09-04 17:08:47 +00:00
Matt Morehouse 7e042bb1d1 [libFuzzer] Port to Windows
Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Patch By: metzman

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman

Differential Revision: https://reviews.llvm.org/D51022

llvm-svn: 341082
2018-08-30 15:54:44 +00:00
Matt Morehouse cf311cfc20 Revert "[libFuzzer] Port to Windows"
This reverts r340949 due to bot breakage again.

llvm-svn: 340954
2018-08-29 18:40:41 +00:00
Matt Morehouse 245ebd71ef [libFuzzer] Port to Windows
Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: #sanitizers, delcypher, morehouse, kcc, eraman

Differential Revision: https://reviews.llvm.org/D51022

llvm-svn: 340949
2018-08-29 18:08:34 +00:00
Matt Morehouse bab8556f01 Revert "[libFuzzer] Port to Windows"
This reverts commit r340860 due to failing tests.

llvm-svn: 340867
2018-08-28 19:07:24 +00:00
Matt Morehouse c6fff3b6f5 [libFuzzer] Port to Windows
Summary:
Port libFuzzer to windows-msvc.
This patch allows libFuzzer targets to be built and run on Windows, using -fsanitize=fuzzer and/or fsanitize=fuzzer-no-link. It allows these forms of coverage instrumentation to work on Windows as well.
It does not fix all issues, such as those with -fsanitize-coverage=stack-depth, which is not usable on Windows as of this patch.
It also does not fix any libFuzzer integration tests. Nearly all of them fail to compile, fixing them will come in a later patch, so libFuzzer tests are disabled on Windows until them.

Patch By: metzman

Reviewers: morehouse, rnk

Reviewed By: morehouse, rnk

Subscribers: morehouse, kcc, eraman

Differential Revision: https://reviews.llvm.org/D51022

llvm-svn: 340860
2018-08-28 18:34:32 +00:00
Evgeniy Stepanov 71dc39823c [fuzzer] Don't run tests on Android.
Need better build system support.

llvm-svn: 335933
2018-06-28 22:16:59 +00:00
Vitaly Buka 9802089e13 libFuzzer, OpenBSD support
Summary:
- Enabling libfuzzer on OpenBSD
- OpenBSD can t support asan, msan ... the tests can t be run.

Patch by David CARLIER

Reviewers: eugenis, phosek, vitalybuka

Reviewed By: vitalybuka

Subscribers: srhines, mgorny, krytarowski, llvm-commits, #sanitizers

Differential Revision: https://reviews.llvm.org/D44877

llvm-svn: 329631
2018-04-09 22:38:26 +00:00
Vlad Tsyrklevich 1781d105ed Add simple runtime tests for shadowcallstack
Summary:
ShadowCallStack does not yet have a runtime provided by compiler-rt, but
this change includes simple tests that make use of a very minimal
runtime in test/shadowcallstack/minimal_runtime.h

Reviewers: pcc, kcc, delcypher, eugenis, filcab

Reviewed By: pcc

Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers, kcc

Differential Revision: https://reviews.llvm.org/D44803

llvm-svn: 329210
2018-04-04 17:53:33 +00:00
Greg Bedwell d6b0ecb795 Allow compiler-rt test targets to work with multi-config CMake generators
Multi-config CMake generators need lit to be able to resolve paths of
artifacts from previous build steps at lit time, rather than expect them
to be fully resolved at CMake time as they may contain the build mode.

Differential Revision: https://reviews.llvm.org/D38471

llvm-svn: 318037
2017-11-13 12:57:54 +00:00
Michal Gorny 806b8d56a2 [cmake] Add a separate CMake var to control profile runtime
Make it possible to control building profile runtime separately from
other options. Before r313549, the profile runtime building was
controlled along with sanitizers. However, since that commit it is built
unconditionally which results in multiple builds for people building
different runtimes separately.

Differential Revision: https://reviews.llvm.org/D38441

llvm-svn: 314646
2017-10-02 05:03:55 +00:00
Vedant Kumar 4a10504e1f [cmake] Make it possible to build and test profile without sanitizers
This should fix an issue which arises when running check-compiler-rt on
the coverage bot:
http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1590/

The bot doesn't build the sanitizers, but the check-compiler-rt target
always expects the profile runtime to exist.

llvm-svn: 313549
2017-09-18 18:13:47 +00:00
Vitaly Buka 581fbc61b2 [asan] Enable asan_and_llvm_coverage_test.cc on Android
Test just needs profile.

llvm-svn: 313438
2017-09-16 03:26:03 +00:00
Evgeniy Stepanov adfa21087f Revert "[ubsan] Make check-ubsan depend on check-ubsan-minimal."
Breaks buildbot with
CMake Error at projects/compiler-rt/test/CMakeLists.txt:76 (add_dependencies):
  The dependency target "check-ubsan-minimal" of target "check-ubsan" does
  not exist.

llvm-svn: 312295
2017-08-31 23:34:01 +00:00
Evgeniy Stepanov a865658a74 [ubsan] Make check-ubsan depend on check-ubsan-minimal.
Summary: This way we don't need to add check-ubsan-minimal steps to all the bots.

Reviewers: vitalybuka

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D37350

llvm-svn: 312291
2017-08-31 22:26:34 +00:00
Vedant Kumar 637e321e35 [fuzzer] Don't enable tests when the fuzzer isn't built
Should fix:
http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1527

llvm-svn: 312157
2017-08-30 19:29:11 +00:00
George Karpenkov 10ab2ace13 Move libFuzzer to compiler_rt.
Resulting library binaries will be named libclang_rt.fuzzer*, and will
be placed in Clang toolchain, allowing redistribution.

Differential Revision: https://reviews.llvm.org/D36908

llvm-svn: 311407
2017-08-21 23:25:50 +00:00
Francis Ricci 23aae3b554 Don't double-include cfi tests on linux
llvm-svn: 306455
2017-06-27 19:52:35 +00:00
Francis Ricci d379d1c2ee Loop directly over sanitizers to build in cmake
Summary: Cleaner than computing the intersection for each possible sanitizer

Reviewers: compnerd, beanz

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D34693

llvm-svn: 306453
2017-06-27 19:32:39 +00:00
Francis Ricci 57a3f4584d Only test sanitizers that are built when COMPILER_RT_SANITIZERS_TO_BUILD is used
Summary: This allows check-all to be used when only a subset of the sanitizers are built.

Reviewers: beanz, compnerd, rnk, pcc

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D34644

llvm-svn: 306450
2017-06-27 19:18:01 +00:00
Francis Ricci 07fa7942fd Revert "Only test sanitizers that are built when COMPILER_RT_SANITIZERS_TO_BUILD is used"
This breaks cfi testing in cases when the cfi runtime isn't built.

This reverts commit 1c6a7b07545f0c9ce68e8b226f5397694ce48af7.

llvm-svn: 306431
2017-06-27 17:24:26 +00:00
Francis Ricci 80296ee7f3 Only test sanitizers that are built when COMPILER_RT_SANITIZERS_TO_BUILD is used
Summary: This allows check-all to be used when only a subset of the sanitizers are built.

Reviewers: beanz, compnerd

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D34644

llvm-svn: 306415
2017-06-27 15:22:56 +00:00
Michal Gorny 2bcd94f8d8 [test] Build sanitizer/xray tests only if COMPILER_RT_BUILD_* is on
Cover the sanitizer tests with COMPILER_RT_BUILD_SANITIZERS
conditional, and add COMPILER_RT_BUILD_XRAY conditional to the xray
tests. This makes it possible to do a pure-builtins build with tests
enabled.

Differential Revision: https://reviews.llvm.org/D32489

llvm-svn: 301387
2017-04-26 07:35:36 +00:00
Erik Pilkington 0490e1c5f4 Reapply r297382: "[compiler-rt][builtins] Add __isOSVersionAtLeast()"
Looks like the problem was a case-insensitive include of dispatch/dispatch.h.

llvm-svn: 297392
2017-03-09 17:02:16 +00:00
Erik Pilkington 4d297df95c Revert "[compiler-rt][builtins] Add __isOSVersionAtLeast()"
This reverts r297382, it was causing build failures.

llvm-svn: 297388
2017-03-09 15:58:26 +00:00
Erik Pilkington 6fa97926e9 [compiler-rt][builtins] Add __isOSVersionAtLeast()
This predicate compares the host's marketing OS version to one passed as
argument. Currently, only darwin targets are supported. This is done by parsing
the SystemVersion.plist file.

Also added in this patch is some lit testing infrastructure for builtins, which
previously had none. This part of the patch was written by Alex Lorenz (with
some minor modifications).

This patch is part of a feature I proposed here:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html

Differential revision: https://reviews.llvm.org/D30136

llvm-svn: 297382
2017-03-09 14:17:36 +00:00
Reid Kleckner e1e344ed05 [asan/win] Delay load dbghelp.dll to delay ucrtbase.dll initialization
Summary:
ASan needs to initialize before ucrtbase.dll so that it can intercept
all of its heap allocations. New versions of dbghelp.dll depend on
ucrtbase.dll, which means both of those DLLs will initialize before the
dynamic ASan runtime. By lazily loading dbghelp.dll with LoadLibrary, we
avoid the issue.

Eventually, I would like to remove our dbghelp.dll dependency in favor
of always using llvm-symbolizer.exe, but this seems like an acceptable
interim solution.

Fixes PR30903

Reviewers: etienneb

Subscribers: kubabrecka, mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D26473

llvm-svn: 286848
2016-11-14 17:37:50 +00:00
Chris Bieneman 5f2546273d [CMake] Adding compiler-rt-test-depends target
This exposes a target for building the compiler-rt test dependencies and matches llvm-test-depends.

llvm-svn: 280393
2016-09-01 18:26:51 +00:00
Chris Bieneman 5968c3ac1f [CMake] Add check-compiler-rt target for runtimes build
Durning standalone builds (which includes runtimes builds) we want to create a target named check-compiler-rt. Additionally we also create check-all if it doesn't already exist as a convienence target that depends on check-compiler-rt.

This allows us to generate a single check target that invokes lit for all test suites in the runtimes projects, while avoiding name collision of check-all and not breaking existing workflows.

llvm-svn: 279334
2016-08-19 22:17:48 +00:00
Dean Michael Berris 68e74847bf [compiler-rt][XRay] Implement __xray_unpatch() and __xray_remove_handler()
Summary:
We also add one test (and the XRay testing infrastructure) to exercise
the patching and unpatching code. This uses the XRay API exported
through the headers as well, installing a custom log handler.

Depends on D23101 for the updated emitted code alignment for the
return/entry sleds.

Reviewers: rSerge, echristo, rnk

Subscribers: tberghammer, danalbert, srhines, mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D23154

llvm-svn: 277971
2016-08-08 03:10:22 +00:00
Etienne Bergeron a07ce512eb [compiler-rt] Activate interception unittests
Summary:
The unittests recently added were not running when executing 'check-all'.
Tests are stable on every archictetures and we can now turn them on.

Reviewers: rnk

Subscribers: llvm-commits, wang0109, chrisha

Differential Revision: https://reviews.llvm.org/D22695

llvm-svn: 276881
2016-07-27 15:29:49 +00:00
Kostya Serebryany 712fc9803a [sanitizer] Initial implementation of a Hardened Allocator
Summary:
This is an initial implementation of a Hardened Allocator based on Sanitizer Common's CombinedAllocator.
It aims at mitigating heap based vulnerabilities by adding several features to the base allocator, while staying relatively fast.
The following were implemented:
- additional consistency checks on the allocation function parameters and on the heap chunks;
- use of checksum protected chunk header, to detect corruption;
- randomness to the allocator base;
- delayed freelist (quarantine), to mitigate use after free and overall determinism.
Additional mitigations are in the works.

Reviewers: eugenis, aizatsky, pcc, krasin, vitalybuka, glider, dvyukov, kcc

Subscribers: kubabrecka, filcab, llvm-commits

Differential Revision: http://reviews.llvm.org/D20084

llvm-svn: 271968
2016-06-07 01:20:26 +00:00
Derek Bruening af7aaae1bc [esan] EfficiencySanitizer base runtime library
Summary:
Adds the initial version of a runtime library for the new
EfficiencySanitizer ("esan") family of tools.  The library includes:

+ Slowpath code via callouts from the compiler instrumentation for
  each memory access.

+ Registration of atexit() to call finalization code.

+ Runtime option flags controlled by the environment variable
  ESAN_OPTIONS.  The common sanitizer flags are supported such as
  verbosity and log_path.

+ An initial simple test.

Still TODO: common code for libc interceptors and shadow memory mapping,
and tool-specific code for shadow state updating.

Reviewers: eugenis, vitalybuka, aizatsky, filcab

Subscribers: filcab, vkalintiris, kubabrecka, llvm-commits, zhaoqin, kcc

Differential Revision: http://reviews.llvm.org/D19168

llvm-svn: 267060
2016-04-21 21:32:25 +00:00
Sean Silva 9af25704d2 Another place for CMAKE_HOST_UNIX
If we don't create the target, don't try to add it as a dependency.

After r265595, we were only creating the SanitizerLintCheck when
`CMAKE_HOST_UNIX` was true.

CMake was emitting a warning:
  The dependency target "SanitizerLintCheck" of target "check-ubsan" does not
  exist.

llvm-svn: 265613
2016-04-06 23:18:09 +00:00
Chris Bieneman a58d0651cb [CMake] Push the dependency on AddLLVM into the test and unites layers
Compiler-rt only relies on LLVM for lit support. Pushing this dependency down into the test and unitest layers will allow builtin libraries to be built without LLVM.

llvm-svn: 261105
2016-02-17 16:38:54 +00:00
Mike Aizatsky 2654299d6a [sanitizers] generating html report on coverage dump
Subscribers: tberghammer, danalbert, srhines

Differential Revision: http://reviews.llvm.org/D16374

llvm-svn: 258999
2016-01-27 23:51:36 +00:00
Evgeniy Stepanov 6922ab1ff6 Revert "Fix CMake warning in CFI tests."
This is a bit more complex than that.

llvm-svn: 257201
2016-01-08 19:56:45 +00:00
Evgeniy Stepanov bec6f6b731 Fix CMake warning in CFI tests.
Fix incorrect condition for enabling the CFI tests. This removes the following CMake warnings on Windows:

The dependency target "cfi" of target "check-all" does not exist.
The dependency target "cfi" of target "check-cfi-and-supported" does not exist.

llvm-svn: 257199
2016-01-08 19:46:18 +00:00
Chris Bieneman 5c64ddfa88 Revert "[CMake] Provide options for toggling on and off various runtime libraries."
This reverts r255170. This change caused a bunch of bot failures and needs to be revised.

llvm-svn: 255184
2015-12-10 00:40:58 +00:00
Chris Bieneman e82ad46f15 [CMake] Provide options for toggling on and off various runtime libraries.
Summary:
Rather than having to add new "experimental" options each time someone wants to work on bringing a sanitizer to a new platform, this patch makes options for all of them.

The default values for the options are set by the platform checks that would have enabled them, but they can be overridden on or off.

Reviewers: kubabrecka, samsonov

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D14846

llvm-svn: 255170
2015-12-09 22:45:03 +00:00
Alexey Samsonov e243d45285 [TSan] Use llvm-objdump+FileCheck instead of standalone .sh script.
llvm-svn: 254959
2015-12-07 22:43:30 +00:00
Alexey Samsonov 4133c18b1c [CFI] Make CFI tests require UBSan (for diagnostic mode).
CFI itself, on the other hand, doesn't require anything, including
sanitizer_common.

llvm-svn: 248830
2015-09-29 21:43:37 +00:00
Peter Collingbourne ea087056ae CFI: Update tests for various bit vector sizes following lowerbitsets optzns.
Also add a test to ensure that this doesn't regress.

Differential Revision: http://reviews.llvm.org/D11584

llvm-svn: 243547
2015-07-29 18:12:45 +00:00
Peter Collingbourne a68d90fa52 UBSan: Enable runtime library tests on Windows, and get most tests passing.
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
2015-07-02 22:08:38 +00:00
Peter Collingbourne b64d0b1e6d Protection against stack-based memory corruption errors using SafeStack: compiler-rt runtime support library
This patch adds runtime support for the Safe Stack protection to compiler-rt
(see http://reviews.llvm.org/D6094 for the detailed description of the
Safe Stack).

This patch is our implementation of the safe stack on top of compiler-rt. The
patch adds basic runtime support for the safe stack to compiler-rt that
manages unsafe stack allocation/deallocation for each thread.

Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.

Differential Revision: http://reviews.llvm.org/D6096

llvm-svn: 239763
2015-06-15 21:08:47 +00:00
Peter Collingbourne e0c4f7eb81 Add test suite for the Control Flow Integrity feature.
Differential Revision: http://reviews.llvm.org/D7738

llvm-svn: 230056
2015-02-20 20:31:18 +00:00
Filipe Cabecinhas a1225be1ea Make FileCheck be a common dependency, not an ASan one.
Summary:
It still gets picked up by ASan, but it also gets picked up by the other
test suites.

Otherwise, some test suites (e.g: UBSan) would complain they had no
dependencies, and wouldn't run.

Reviewers: samsonov, eugenis

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D7740

llvm-svn: 229962
2015-02-20 03:41:07 +00:00