Commit Graph

50 Commits

Author SHA1 Message Date
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
Reid Kleckner 04748b98a6 Don't make check-sanitizer depend on profile on Windows
We don't build the profiling library on Windows, so CMake warns that the
target doesn't exist.

llvm-svn: 222588
2014-11-21 23:09:51 +00:00
Kostya Serebryany fd5e21adba [asan] make sanitizer tests depend on libclang_rt.profile since we now have a test that uses -coverage
llvm-svn: 218427
2014-09-24 23:54:04 +00:00
Alexey Samsonov 68b9e74592 [CMake] Determine which compiler-rt libraries are supported on
a given platform in a top-level CMakeLists.txt to use it both
in lib/ and in test/ subdirectories. Move architecture/platform
checks to config-ix.

llvm-svn: 215247
2014-08-08 22:01:20 +00:00
Duncan P. N. Exon Smith ae2f0bbcf1 InstrProf: Add simple compiler-rt test
Add the test infrastructure for testing lib/profile and a single test.
This initial commit only enables the tests on Darwin, but they'll be
enabled on Linux soon after.

<rdar://problem/16458307>

llvm-svn: 205256
2014-03-31 22:45:37 +00:00
Alexey Samsonov 04e7ad29ea [CMake] Introduce check-all command for standalone compiler-rt build
llvm-svn: 201780
2014-02-20 12:36:26 +00:00
Alexey Samsonov 35a66d15d4 Move config for sanitizer_common tests under test/ for consistency
llvm-svn: 201779
2014-02-20 12:18:08 +00:00
Alexey Samsonov aa980c760b [CMake] Add the way to run tests in standalone build.
1) Depend on llvm-config (configured in LLVM_CONFIG_PATH) to
get necessary LLVM source/binary directories.
2) Add basic support for running lit tests (check-xsan commands).
For now this "support" is far from what we want:
  * unit tests are not built currently.
  * lit tests use Clang/compiler-rt from LLVM build directory,
    not the host compiler or just-built compiler-rt libraries.

We should make a choice on the way we intend ti run compiler-rt lit testsuite:
a) use either Clang from LLVM build tree, or the host compiler.
b) use either just-built runtimes, or the runtimes shipped with the
host compiler.

Using just-built runtimes is tricky - we have to know where to put them, so that
Clang/GCC driver would pick them up (and not overwrite the existing runtimes).
Using a host compiler instead of Clang from LLVM build tree will give us a chance to
run lit tests under GCC (which already has support for several sanitizers).

That is, I tend to make the following choice: if we're in a standalone compiler-rt
build, use host compiler with its set of runtime libraries to run lit tests.
This will effectively decouple "make compiler-rt" and "make check-compiler-rt" in
a standalone build - the latter wouldn't invoke the former. Note that if we decide
to fix LLVM/Clang/compiler-rt build system so that it would configure/build
compiler-rt with just-built Clang (as we do in Makefile-based build), this will not
be a problem - we can add a dependency to ensure that clang/compiler-rt are rebuilt
before running compiler-rt tests.

llvm-svn: 201656
2014-02-19 10:04:29 +00:00
Alexey Samsonov b73db72a17 [CMake] Simplify setting compile flag disabling RTTI
llvm-svn: 201547
2014-02-18 07:52:40 +00:00
Alexey Samsonov 9a70077b47 [ASan] Rename asan_runtime_libraries to asan. Re-enable tests on Android.
llvm-svn: 201417
2014-02-14 14:45:13 +00:00
Alexey Samsonov e6a6183e9b Move TSan lit-tests under test/tsan
llvm-svn: 201414
2014-02-14 14:35:48 +00:00
Alexey Samsonov 9f20d67034 Move ASan lit-tests under test/asan
llvm-svn: 201413
2014-02-14 14:06:10 +00:00
Alexey Samsonov 8434e60f7e Move MSan lit-tests under test/msan
llvm-svn: 201412
2014-02-14 13:02:58 +00:00
Alexey Samsonov 7eeef85bd4 Move LSan test suite under test/
llvm-svn: 201408
2014-02-14 12:26:05 +00:00
Alexey Samsonov f6cf6ab53b Move DFSan test suite under test/
llvm-svn: 201403
2014-02-14 12:05:41 +00:00
Alexey Samsonov ba869e79a0 Move UBSan test suite under test/
llvm-svn: 201401
2014-02-14 11:42:22 +00:00
Alexey Samsonov 81a2b466e9 Move shared configs for lit test suites to test/ and unittests/ directories
llvm-svn: 201399
2014-02-14 11:00:07 +00:00
Chandler Carruth 6acfaaf3aa Remove the old, and non-functional CMake build system from CompilerRT.
I cannot build any part of this successfully on either Linux or Darwin,
and the replacement is worlds simpler by requiring that this be built as
a subproject of LLVM. If this breaks you for any reason, please let me
know, and let me know what your use case is.

llvm-svn: 154059
2012-04-04 22:12:01 +00:00
Edward O'Callaghan 7c1cc70a90 Fix test suit for last CMake changes to CompilerRT.
llvm-svn: 85452
2009-10-29 00:16:23 +00:00
Edward O'Callaghan 6d0a86cbd1 Update web docs for cmake test suit, comment out broken test.
llvm-svn: 85350
2009-10-28 00:09:30 +00:00
Edward O'Callaghan 1bafa6de57 Fix cmake test suit for compiler-rt.
llvm-svn: 85339
2009-10-27 23:23:41 +00:00
Edward O'Callaghan c0c9968f1b Comment out broken tests and make the rest build in cmake build system.
llvm-svn: 84330
2009-10-17 10:19:32 +00:00
Edward O'Callaghan 882b798a50 Generalize Blocks code and intergrate with cmake build system more.
llvm-svn: 81613
2009-09-12 15:47:39 +00:00
Edward O'Callaghan ccf48131d0 Refactor to remove un-named struct gnu extension usage. Now ISO C89 and C99 compliant. Comment trailing endifs
llvm-svn: 78537
2009-08-09 18:41:02 +00:00
Edward O'Callaghan df72046277 Start porting compiler-rt testsuit to Solaris with new build system. Fix some C++ style comments which are not allowed in ISO C90.
llvm-svn: 78143
2009-08-05 01:47:29 +00:00
Edward O'Callaghan 6912ed0f36 Initial import of CMake type build system. Just like the rest of llvm..
llvm-svn: 77933
2009-08-03 01:08:25 +00:00