Backed out changeset 3050967a3854 (bug 1896351) for causing fuzzing bustages.

This commit is contained in:
Tamas Szentpeteri 2024-05-15 15:13:14 +03:00
parent 09dc5bb1dc
commit 329474c3dc
2 changed files with 25 additions and 24 deletions

View File

@ -40,7 +40,10 @@ 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
@ -51,7 +54,10 @@ 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
@ -62,12 +68,16 @@ 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"
@ -76,12 +86,16 @@ 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"
@ -90,6 +104,7 @@ 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"
@ -98,10 +113,16 @@ 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.
@ -110,6 +131,9 @@ 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.

View File

@ -2422,8 +2422,6 @@ def asan():
add_old_configure_assignment("MOZ_ASAN", asan)
set_define("MOZ_ASAN", True, when=asan)
set_config("MOZ_ASAN", True, when=asan)
# MSAN
# ==============================================================
@ -2437,8 +2435,6 @@ def msan():
add_old_configure_assignment("MOZ_MSAN", msan)
set_define("MOZ_MSAN", True, when=msan)
set_config("MOZ_MSAN", True, when=msan)
# TSAN
# ==============================================================
@ -2452,8 +2448,6 @@ def tsan():
add_old_configure_assignment("MOZ_TSAN", tsan)
set_define("MOZ_TSAN", True, when=tsan)
set_config("MOZ_TSAN", True, when=tsan)
# UBSAN
# ==============================================================
@ -2490,6 +2484,7 @@ 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)",
@ -2502,8 +2497,6 @@ 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,23 +2511,7 @@ 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
# ==============================================================