зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1896351 - Move sanitizer-related AC_SUBST and AC_DEFINE from old-configure to moz.configure r=glandium
Also: - deactivate LLVM_SYMBOLIZER on android mozconfig as we don't cross compile it yet. - enforce LLVM_SYMBOLIZER when fuzzing is on - fix osx packaging to include llvm-symbolizer when fuzzing, and provide it through tc Differential Revision: https://phabricator.services.mozilla.com/D210190
This commit is contained in:
Родитель
b6cbb18bf3
Коммит
ad2077c399
|
@ -10,7 +10,7 @@
|
|||
#endif
|
||||
/gtest/***
|
||||
/http3server
|
||||
#if defined(MOZ_ASAN) || defined(MOZ_TSAN)
|
||||
#if defined(MOZ_ASAN) || defined(MOZ_TSAN) || defined(FUZZING)
|
||||
/llvm-symbolizer
|
||||
#endif
|
||||
#if defined(MOZ_CRASHREPORTER)
|
||||
|
|
|
@ -10,6 +10,7 @@ for s in (
|
|||
"MOZ_GECKODRIVER",
|
||||
"MOZ_ASAN",
|
||||
"MOZ_TSAN",
|
||||
"FUZZING",
|
||||
"MOZ_CRASHREPORTER",
|
||||
"MOZ_APP_NAME",
|
||||
):
|
||||
|
|
|
@ -6,4 +6,6 @@ ac_add_options --enable-fuzzing
|
|||
# Need this to prevent name conflicts with the normal nightly build packages
|
||||
export MOZ_PKG_SPECIAL=fuzzing
|
||||
|
||||
export LLVM_SYMBOLIZER="$MOZ_FETCHES_DIR/llvm-symbolizer/bin/llvm-symbolizer"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
|
|
|
@ -40,10 +40,7 @@ if test -n "$MOZ_ASAN"; then
|
|||
if test -z "$CLANG_CL"; then
|
||||
LDFLAGS="-fsanitize=address -rdynamic $LDFLAGS"
|
||||
fi
|
||||
AC_DEFINE(MOZ_ASAN)
|
||||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_ASAN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use Memory Sanitizer
|
||||
|
@ -54,10 +51,7 @@ if test -n "$MOZ_MSAN"; then
|
|||
if test -z "$CLANG_CL"; then
|
||||
LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins -rdynamic $LDFLAGS"
|
||||
fi
|
||||
AC_DEFINE(MOZ_MSAN)
|
||||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_MSAN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use Thread Sanitizer
|
||||
|
@ -68,16 +62,12 @@ if test -n "$MOZ_TSAN"; then
|
|||
if test -z "$CLANG_CL"; then
|
||||
LDFLAGS="-fsanitize=thread -rdynamic $LDFLAGS"
|
||||
fi
|
||||
AC_DEFINE(MOZ_TSAN)
|
||||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_TSAN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use UndefinedBehavior Sanitizer (with custom checks)
|
||||
dnl ========================================================
|
||||
if test -n "$MOZ_UBSAN_CHECKS"; then
|
||||
MOZ_UBSAN=1
|
||||
UBSAN_TXT="$_objdir/ubsan_blacklist.txt"
|
||||
cat $_topsrcdir/build/sanitizers/ubsan_*_blacklist.txt > $UBSAN_TXT
|
||||
UBSAN_FLAGS="-fsanitize=$MOZ_UBSAN_CHECKS -fno-sanitize-recover=$MOZ_UBSAN_CHECKS -fsanitize-blacklist=$UBSAN_TXT"
|
||||
|
@ -86,16 +76,12 @@ if test -n "$MOZ_UBSAN_CHECKS"; then
|
|||
if test -z "$CLANG_CL"; then
|
||||
LDFLAGS="-fsanitize=undefined -rdynamic $LDFLAGS"
|
||||
fi
|
||||
AC_DEFINE(MOZ_UBSAN)
|
||||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_UBSAN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use UndefinedBehavior Sanitizer to find integer overflows
|
||||
dnl ========================================================
|
||||
if test -n "$MOZ_SIGNED_OVERFLOW_SANITIZE$MOZ_UNSIGNED_OVERFLOW_SANITIZE"; then
|
||||
MOZ_UBSAN=1
|
||||
SANITIZER_BLACKLISTS=""
|
||||
if test -n "$MOZ_SIGNED_OVERFLOW_SANITIZE"; then
|
||||
SANITIZER_BLACKLISTS="-fsanitize-blacklist=$_topsrcdir/build/sanitizers/ubsan_signed_overflow_blacklist.txt $SANITIZER_BLACKLISTS"
|
||||
|
@ -104,7 +90,6 @@ if test -n "$MOZ_SIGNED_OVERFLOW_SANITIZE$MOZ_UNSIGNED_OVERFLOW_SANITIZE"; then
|
|||
if test -z "$CLANG_CL"; then
|
||||
LDFLAGS="-fsanitize=signed-integer-overflow -rdynamic $LDFLAGS"
|
||||
fi
|
||||
AC_DEFINE(MOZ_SIGNED_OVERFLOW_SANITIZE)
|
||||
fi
|
||||
if test -n "$MOZ_UNSIGNED_OVERFLOW_SANITIZE"; then
|
||||
SANITIZER_BLACKLISTS="-fsanitize-blacklist=$_topsrcdir/build/sanitizers/ubsan_unsigned_overflow_blacklist.txt $SANITIZER_BLACKLISTS"
|
||||
|
@ -113,16 +98,10 @@ if test -n "$MOZ_SIGNED_OVERFLOW_SANITIZE$MOZ_UNSIGNED_OVERFLOW_SANITIZE"; then
|
|||
if test -z "$CLANG_CL"; then
|
||||
LDFLAGS="-fsanitize=unsigned-integer-overflow -rdynamic $LDFLAGS"
|
||||
fi
|
||||
AC_DEFINE(MOZ_UNSIGNED_OVERFLOW_SANITIZE)
|
||||
fi
|
||||
CFLAGS="$SANITIZER_BLACKLISTS $CFLAGS"
|
||||
CXXFLAGS="$SANITIZER_BLACKLISTS $CXXFLAGS"
|
||||
AC_DEFINE(MOZ_UBSAN)
|
||||
MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
|
||||
fi
|
||||
AC_SUBST(MOZ_SIGNED_OVERFLOW_SANITIZE)
|
||||
AC_SUBST(MOZ_UNSIGNED_OVERFLOW_SANITIZE)
|
||||
AC_SUBST(MOZ_UBSAN)
|
||||
|
||||
dnl =======================================================
|
||||
dnl = Required for stand-alone (sanitizer-less) libFuzzer.
|
||||
|
@ -131,9 +110,6 @@ if test -n "$LIBFUZZER"; then
|
|||
LDFLAGS="$LIBFUZZER_FLAGS -rdynamic $LDFLAGS"
|
||||
fi
|
||||
|
||||
# The LLVM symbolizer is used by all sanitizers
|
||||
AC_SUBST(LLVM_SYMBOLIZER)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Test for whether the compiler is compatible with the
|
||||
dnl = given sanitize options.
|
||||
|
|
|
@ -2429,6 +2429,8 @@ def asan():
|
|||
|
||||
|
||||
add_old_configure_assignment("MOZ_ASAN", asan)
|
||||
set_define("MOZ_ASAN", True, when=asan)
|
||||
set_config("MOZ_ASAN", True, when=asan)
|
||||
|
||||
# MSAN
|
||||
# ==============================================================
|
||||
|
@ -2442,6 +2444,8 @@ def msan():
|
|||
|
||||
|
||||
add_old_configure_assignment("MOZ_MSAN", msan)
|
||||
set_define("MOZ_MSAN", True, when=msan)
|
||||
set_config("MOZ_MSAN", True, when=msan)
|
||||
|
||||
# TSAN
|
||||
# ==============================================================
|
||||
|
@ -2455,6 +2459,8 @@ def tsan():
|
|||
|
||||
|
||||
add_old_configure_assignment("MOZ_TSAN", tsan)
|
||||
set_define("MOZ_TSAN", True, when=tsan)
|
||||
set_config("MOZ_TSAN", True, when=tsan)
|
||||
|
||||
# UBSAN
|
||||
# ==============================================================
|
||||
|
@ -2491,7 +2497,6 @@ def ubsan(options, optimize):
|
|||
|
||||
add_old_configure_assignment("MOZ_UBSAN_CHECKS", ubsan)
|
||||
|
||||
|
||||
option(
|
||||
"--enable-signed-overflow-sanitizer",
|
||||
help="Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts)",
|
||||
|
@ -2504,6 +2509,8 @@ def ub_signed_overflow_san():
|
|||
|
||||
|
||||
add_old_configure_assignment("MOZ_SIGNED_OVERFLOW_SANITIZE", ub_signed_overflow_san)
|
||||
set_define("MOZ_SIGNED_OVERFLOW_SANITIZE", True, when=ub_signed_overflow_san)
|
||||
set_config("MOZ_SIGNED_OVERFLOW_SANITIZE", True, when=ub_signed_overflow_san)
|
||||
|
||||
|
||||
option(
|
||||
|
@ -2518,7 +2525,14 @@ def ub_unsigned_overflow_san():
|
|||
|
||||
|
||||
add_old_configure_assignment("MOZ_UNSIGNED_OVERFLOW_SANITIZE", ub_unsigned_overflow_san)
|
||||
set_define("MOZ_UNSIGNED_OVERFLOW_SANITIZE", True, when=ub_unsigned_overflow_san)
|
||||
set_config("MOZ_UNSIGNED_OVERFLOW_SANITIZE", True, when=ub_unsigned_overflow_san)
|
||||
|
||||
#
|
||||
|
||||
any_ubsan = ubsan | ub_signed_overflow_san | ub_unsigned_overflow_san
|
||||
set_define("MOZ_UBSAN", True, when=any_ubsan)
|
||||
set_config("MOZ_UBSAN", any_ubsan)
|
||||
|
||||
# Security Hardening
|
||||
# ==============================================================
|
||||
|
@ -3122,6 +3136,16 @@ set_config("HAVE_LIBFUZZER_FLAG_FUZZER_NO_LINK", libfuzzer_flags.no_link_flag_su
|
|||
set_config("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags)
|
||||
add_old_configure_assignment("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags)
|
||||
|
||||
# The LLVM symbolizer is used by all sanitizers
|
||||
check_prog(
|
||||
"LLVM_SYMBOLIZER",
|
||||
("llvm-symbolizer",),
|
||||
allow_missing=True,
|
||||
paths=clang_search_path,
|
||||
when=asan | msan | tsan | any_ubsan | enable_fuzzing,
|
||||
)
|
||||
|
||||
|
||||
# Shared library building
|
||||
# ==============================================================
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ ac_add_options --enable-fuzzing
|
|||
unset MOZ_STDCXX_COMPAT
|
||||
unset ENABLE_CLANG_PLUGIN
|
||||
|
||||
# We don't have a native LLVM_SYMBOLIZER yet
|
||||
unset LLVM_SYMBOLIZER
|
||||
|
||||
# Add the path to the clang_rt used, so it can be packaged with the build.
|
||||
if [ -d "$MOZ_FETCHES_DIR/clang" ]; then
|
||||
CLANG_LIB_DIR="$(cd $MOZ_FETCHES_DIR/clang/lib/clang/*/lib/linux && pwd)"
|
||||
|
|
|
@ -201,6 +201,7 @@ macosx64-fuzzing/debug:
|
|||
- linux64-clang
|
||||
- linux64-sccache
|
||||
- macosx64-sdk
|
||||
- macosx64-llvm-symbolizer
|
||||
- sysroot-wasm32-wasi
|
||||
optimization:
|
||||
skip-unless-expanded: null
|
||||
|
|
Загрузка…
Ссылка в новой задаче