2012-12-25 20:39:56 +08:00
|
|
|
include_directories(..)
|
2012-12-11 20:27:27 +08:00
|
|
|
|
2012-12-25 20:39:56 +08:00
|
|
|
# Runtime library sources and build flags.
|
|
|
|
set(MSAN_RTL_SOURCES
|
2019-08-01 22:08:18 +08:00
|
|
|
msan.cpp
|
|
|
|
msan_allocator.cpp
|
|
|
|
msan_chained_origin_depot.cpp
|
|
|
|
msan_interceptors.cpp
|
|
|
|
msan_linux.cpp
|
|
|
|
msan_report.cpp
|
|
|
|
msan_thread.cpp
|
|
|
|
msan_poisoning.cpp
|
2012-12-11 20:27:27 +08:00
|
|
|
)
|
2014-02-18 15:52:40 +08:00
|
|
|
|
2015-04-28 06:08:09 +08:00
|
|
|
set(MSAN_RTL_CXX_SOURCES
|
2019-08-01 22:08:18 +08:00
|
|
|
msan_new_delete.cpp
|
|
|
|
)
|
2015-04-28 06:08:09 +08:00
|
|
|
|
2018-07-10 21:00:17 +08:00
|
|
|
set(MSAN_RTL_HEADERS
|
|
|
|
msan.h
|
|
|
|
msan_allocator.h
|
|
|
|
msan_chained_origin_depot.h
|
|
|
|
msan_flags.h
|
|
|
|
msan_flags.inc
|
|
|
|
msan_interface_internal.h
|
|
|
|
msan_origin.h
|
|
|
|
msan_poisoning.h
|
|
|
|
msan_report.h
|
2021-05-15 11:07:09 +08:00
|
|
|
msan_thread.h
|
|
|
|
)
|
2015-04-28 06:08:09 +08:00
|
|
|
|
2014-02-18 16:07:09 +08:00
|
|
|
set(MSAN_RTL_CFLAGS ${SANITIZER_COMMON_CFLAGS})
|
2018-03-03 20:00:12 +08:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|
|
|
append_list_if(COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC -ftls-model=initial-exec MSAN_RTL_CFLAGS)
|
|
|
|
endif()
|
2016-03-05 18:01:04 +08:00
|
|
|
append_rtti_flag(OFF MSAN_RTL_CFLAGS)
|
Adding Msan support to FreeBSD
Summary:
Enabling the memory sanitizer support for FreeBSD, most of unit tests are compatible.
- Adding fstat and stressor_r interceptors.
- Updating the struct link_map access since most likely the struct Obj_Entry had been updated since.
- Disabling few unit tests until further work is needed (or we can assume it can work in real world code).
Patch by: David CARLIER
Reviewers: vitalybuka, krytarowski
Reviewed By: vitalybuka
Subscribers: eugenis, dim, srhines, emaste, kubamracek, mgorny, fedor.sergeev, hintonda, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43080
llvm-svn: 326644
2018-03-03 19:43:11 +08:00
|
|
|
if(NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|
|
|
append_list_if(COMPILER_RT_HAS_FPIE_FLAG -fPIE MSAN_RTL_CFLAGS)
|
|
|
|
endif()
|
2014-02-18 16:07:09 +08:00
|
|
|
# Prevent clang from generating libc calls.
|
2014-10-16 06:47:54 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FFREESTANDING_FLAG -ffreestanding MSAN_RTL_CFLAGS)
|
2012-12-11 20:27:27 +08:00
|
|
|
|
2014-05-10 06:11:03 +08:00
|
|
|
set(MSAN_RUNTIME_LIBRARIES)
|
|
|
|
|
2012-12-25 20:39:56 +08:00
|
|
|
# Static runtime library.
|
2016-08-27 04:52:22 +08:00
|
|
|
add_compiler_rt_component(msan)
|
2016-07-12 05:51:56 +08:00
|
|
|
|
2014-11-20 05:42:33 +08:00
|
|
|
foreach(arch ${MSAN_SUPPORTED_ARCH})
|
2015-08-26 03:53:09 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.msan
|
|
|
|
STATIC
|
|
|
|
ARCHS ${arch}
|
2013-01-20 22:14:13 +08:00
|
|
|
SOURCES ${MSAN_RTL_SOURCES}
|
|
|
|
$<TARGET_OBJECTS:RTInterception.${arch}>
|
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
|
2013-05-18 00:17:19 +08:00
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>
|
[sanitizer] Split coverage into separate RT in sanitizer_common
Summary:
`sanitizer_common`'s coverage support is fairly well separated, and libcdep by
default. Several sanitizers don't make use of coverage, and as far as I can
tell do no benefit from the extra dependencies pulled in by the coverage public
interface functions.
The following sanitizers call `InitializeCoverage` explicitely: MSan, ASan,
LSan, HWAsan, UBSan. On top of this, any sanitizer bundling RTUBSan should
add the coverage RT as well: ASan, Scudo, UBSan, CFI (diag), TSan, MSan, HWAsan.
So in the end the following have no need: DFSan, ESan, CFI, SafeStack (nolibc
anyway), XRay, and the upcoming Scudo minimal runtime.
I tested this with all the sanitizers check-* with gcc & clang, and in
standalone on Linux & Android, and there was no issue. I couldn't test this on
Mac, Fuchsia, BSDs, & Windows for lack of an environment, so adding a bunch of
people for additional scrunity. I couldn't test HWAsan either.
Reviewers: eugenis, vitalybuka, alekseyshl, flowerhack, kubamracek, dberris, rnk, krytarowski
Reviewed By: vitalybuka, alekseyshl, flowerhack, dberris
Subscribers: mgorny, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D44701
llvm-svn: 328204
2018-03-22 23:04:31 +08:00
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonCoverage.${arch}>
|
[sanitizer] Split Symbolizer/StackTraces from core RTSanitizerCommon
Summary:
Host symbolizer & stacktraces related code in their own RT:
`RTSanitizerCommonSymbolizer`, which is "libcdep" by nature. Symbolizer &
stacktraces specific code that used to live in common files is moved to a new
file `sanitizer_symbolizer_report.cc` as is.
The purpose of this is the enforce a separation between code that relies on
symbolization and code that doesn't. This saves the inclusion of spurious code
due to the interface functions with default visibility, and the extra data
associated.
The following sanitizers makefiles were modified & tested locally:
- dfsan: doesn't require the new symbolizer RT
- esan: requires it
- hwasan: requires it
- lsan: requires it
- msan: requires it
- safestack: doesn't require it
- xray: doesn't require it
- tsan: requires it
- ubsan: requires it
- ubsan_minimal: doesn't require it
- scudo: requires it (but not for Fuchsia that has a minimal runtime)
This was tested locally on Linux, Android, Fuchsia.
Reviewers: alekseyshl, eugenis, dberris, kubamracek, vitalybuka, dvyukov, mcgrathr
Reviewed By: alekseyshl, vitalybuka
Subscribers: srhines, kubamracek, mgorny, krytarowski, delcypher, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D45457
llvm-svn: 330131
2018-04-17 00:32:19 +08:00
|
|
|
$<TARGET_OBJECTS:RTSanitizerCommonSymbolizer.${arch}>
|
2015-04-28 08:56:48 +08:00
|
|
|
$<TARGET_OBJECTS:RTUbsan.${arch}>
|
2018-07-10 21:00:17 +08:00
|
|
|
ADDITIONAL_HEADERS ${MSAN_RTL_HEADERS}
|
2015-08-26 03:53:09 +08:00
|
|
|
CFLAGS ${MSAN_RTL_CFLAGS}
|
|
|
|
PARENT_TARGET msan)
|
|
|
|
add_compiler_rt_runtime(clang_rt.msan_cxx
|
|
|
|
STATIC
|
|
|
|
ARCHS ${arch}
|
2015-04-28 06:08:09 +08:00
|
|
|
SOURCES ${MSAN_RTL_CXX_SOURCES}
|
2015-04-28 08:56:48 +08:00
|
|
|
$<TARGET_OBJECTS:RTUbsan_cxx.${arch}>
|
2018-07-10 21:00:17 +08:00
|
|
|
ADDITIONAL_HEADERS ${MSAN_RTL_HEADERS}
|
2015-08-26 03:53:09 +08:00
|
|
|
CFLAGS ${MSAN_RTL_CFLAGS}
|
|
|
|
PARENT_TARGET msan)
|
2015-04-28 06:08:09 +08:00
|
|
|
list(APPEND MSAN_RUNTIME_LIBRARIES clang_rt.msan-${arch}
|
|
|
|
clang_rt.msan_cxx-${arch})
|
2018-05-10 05:24:06 +08:00
|
|
|
if(SANITIZER_USE_SYMBOLS)
|
2015-08-28 04:07:54 +08:00
|
|
|
add_sanitizer_rt_symbols(clang_rt.msan
|
|
|
|
ARCHS ${arch}
|
2015-08-27 07:12:25 +08:00
|
|
|
EXTRA msan.syms.extra)
|
2015-08-28 04:07:54 +08:00
|
|
|
add_sanitizer_rt_symbols(clang_rt.msan_cxx
|
|
|
|
ARCHS ${arch}
|
2015-08-27 07:12:25 +08:00
|
|
|
EXTRA msan.syms.extra)
|
2015-04-28 06:08:09 +08:00
|
|
|
add_dependencies(msan clang_rt.msan-${arch}-symbols
|
|
|
|
clang_rt.msan_cxx-${arch}-symbols)
|
2013-08-28 16:07:04 +08:00
|
|
|
endif()
|
2014-11-20 05:42:33 +08:00
|
|
|
endforeach()
|
2012-12-25 20:39:56 +08:00
|
|
|
|
2021-05-04 21:50:43 +08:00
|
|
|
add_compiler_rt_resource_file(msan_ignorelist msan_ignorelist.txt msan)
|
|
|
|
list(APPEND MSAN_RUNTIME_LIBRARIES msan_ignorelist)
|
2013-06-10 17:09:40 +08:00
|
|
|
|
2014-02-19 19:18:47 +08:00
|
|
|
if(COMPILER_RT_INCLUDE_TESTS)
|
2012-12-25 20:39:56 +08:00
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|