2016-02-18 00:38:54 +08:00
|
|
|
# Needed for lit support
|
|
|
|
include(AddLLVM)
|
|
|
|
|
2014-02-14 19:00:07 +08:00
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)
|
|
|
|
|
|
|
|
# BlocksRuntime and builtins testsuites are not yet ported to lit.
|
|
|
|
# add_subdirectory(BlocksRuntime)
|
|
|
|
# add_subdirectory(builtins)
|
2014-02-14 19:42:22 +08:00
|
|
|
|
2014-02-19 18:04:29 +08:00
|
|
|
set(SANITIZER_COMMON_LIT_TEST_DEPS)
|
2015-02-20 11:41:07 +08:00
|
|
|
if(COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
add_executable(FileCheck IMPORTED GLOBAL)
|
|
|
|
set_property(TARGET FileCheck PROPERTY IMPORTED_LOCATION ${LLVM_TOOLS_BINARY_DIR}/FileCheck)
|
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS FileCheck)
|
|
|
|
endif()
|
|
|
|
|
2014-02-18 15:52:40 +08:00
|
|
|
# When ANDROID, we build tests with the host compiler (i.e. CMAKE_C_COMPILER),
|
|
|
|
# and run tests with tools from the host toolchain.
|
2014-02-19 18:04:29 +08:00
|
|
|
if(NOT ANDROID)
|
|
|
|
if(NOT COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
# Use LLVM utils and Clang from the same build tree.
|
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS
|
2015-12-08 06:43:30 +08:00
|
|
|
clang clang-headers FileCheck count not llvm-config llvm-nm llvm-objdump
|
2016-01-28 07:51:36 +08:00
|
|
|
llvm-symbolizer compiler-rt-headers sancov)
|
2014-11-22 07:09:51 +08:00
|
|
|
if (COMPILER_RT_HAS_PROFILE)
|
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile)
|
|
|
|
endif()
|
2015-07-03 06:08:38 +08:00
|
|
|
if (WIN32)
|
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS KillTheDoctor)
|
|
|
|
endif()
|
2014-02-19 18:04:29 +08:00
|
|
|
endif()
|
2016-04-07 07:18:09 +08:00
|
|
|
if(CMAKE_HOST_UNIX)
|
2014-02-18 15:52:40 +08:00
|
|
|
list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS SanitizerLintCheck)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2014-02-14 19:42:22 +08:00
|
|
|
# Run sanitizer tests only if we're sure that clang would produce
|
|
|
|
# working binaries.
|
|
|
|
if(COMPILER_RT_CAN_EXECUTE_TESTS)
|
2015-12-10 08:40:58 +08:00
|
|
|
if(COMPILER_RT_HAS_ASAN)
|
|
|
|
add_subdirectory(asan)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_HAS_DFSAN)
|
|
|
|
add_subdirectory(dfsan)
|
|
|
|
endif()
|
2016-07-27 23:29:49 +08:00
|
|
|
if (COMPILER_RT_HAS_INTERCEPTION)
|
|
|
|
add_subdirectory(interception)
|
|
|
|
endif()
|
2015-12-10 08:40:58 +08:00
|
|
|
if(COMPILER_RT_HAS_LSAN)
|
|
|
|
add_subdirectory(lsan)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_HAS_MSAN)
|
|
|
|
add_subdirectory(msan)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_HAS_PROFILE)
|
|
|
|
add_subdirectory(profile)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_HAS_SANITIZER_COMMON)
|
|
|
|
add_subdirectory(sanitizer_common)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_HAS_TSAN)
|
|
|
|
add_subdirectory(tsan)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_HAS_UBSAN)
|
|
|
|
add_subdirectory(ubsan)
|
|
|
|
endif()
|
|
|
|
# CFI tests require diagnostic mode, which is implemented in UBSan.
|
2016-01-09 03:56:45 +08:00
|
|
|
if(COMPILER_RT_HAS_UBSAN)
|
2015-12-10 08:40:58 +08:00
|
|
|
add_subdirectory(cfi)
|
|
|
|
endif()
|
|
|
|
if(COMPILER_RT_HAS_SAFESTACK)
|
|
|
|
add_subdirectory(safestack)
|
|
|
|
endif()
|
2016-04-22 05:32:25 +08:00
|
|
|
if(COMPILER_RT_HAS_ESAN)
|
|
|
|
add_subdirectory(esan)
|
|
|
|
endif()
|
[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 09:20:26 +08:00
|
|
|
if(COMPILER_RT_HAS_SCUDO)
|
|
|
|
add_subdirectory(scudo)
|
|
|
|
endif()
|
2016-08-08 11:10:22 +08:00
|
|
|
if(COMPILER_RT_HAS_XRAY)
|
|
|
|
add_subdirectory(xray)
|
|
|
|
endif()
|
2014-02-14 19:42:22 +08:00
|
|
|
endif()
|
2014-02-20 20:36:26 +08:00
|
|
|
|
|
|
|
if(COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
# Now that we've traversed all the directories and know all the lit testsuites,
|
|
|
|
# introduce a rule to run to run all of them.
|
|
|
|
get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
|
|
|
|
get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
|
|
|
|
add_lit_target(check-all
|
|
|
|
"Running all regression tests"
|
|
|
|
${LLVM_LIT_TESTSUITES}
|
|
|
|
DEPENDS ${LLVM_LIT_DEPENDS})
|
|
|
|
endif()
|