mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1896351 - Move sanitizer-related AC_SUBST and AC_DEFINE from old-configure to moz.configure r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D210190
This commit is contained in:
parent
98edf786e6
commit
861cbbc578
@ -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.
|
||||
|
@ -2422,6 +2422,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
|
||||
# ==============================================================
|
||||
@ -2435,6 +2437,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
|
||||
# ==============================================================
|
||||
@ -2448,6 +2452,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
|
||||
# ==============================================================
|
||||
@ -2484,7 +2490,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)",
|
||||
@ -2497,6 +2502,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(
|
||||
@ -2511,7 +2518,23 @@ 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)
|
||||
|
||||
# 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,
|
||||
)
|
||||
|
||||
# Security Hardening
|
||||
# ==============================================================
|
||||
|
Loading…
Reference in New Issue
Block a user