Bug 1557583 - Move --enable-*-sanitizers options to python configure. r=dmajor

But keep the corresponding logic in sanitize.m4.

Differential Revision: https://phabricator.services.mozilla.com/D34116

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-06-07 13:08:27 +00:00
parent 44e96352da
commit 958968bcdc
3 changed files with 50 additions and 22 deletions

View File

@ -40,10 +40,6 @@ AC_SUBST(MOZ_ASAN)
dnl ========================================================
dnl = Use Memory Sanitizer
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
[ --enable-memory-sanitizer Enable Memory Sanitizer (default=no)],
MOZ_MSAN=1,
MOZ_MSAN= )
if test -n "$MOZ_MSAN"; then
CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins $CFLAGS"
CXXFLAGS="-fsanitize=memory -fsanitize-memory-track-origins $CXXFLAGS"
@ -58,10 +54,6 @@ AC_SUBST(MOZ_MSAN)
dnl ========================================================
dnl = Use Thread Sanitizer
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(thread-sanitizer,
[ --enable-thread-sanitizer Enable Thread Sanitizer (default=no)],
MOZ_TSAN=1,
MOZ_TSAN= )
if test -n "$MOZ_TSAN"; then
CFLAGS="-fsanitize=thread $CFLAGS"
CXXFLAGS="-fsanitize=thread $CXXFLAGS"
@ -94,16 +86,6 @@ AC_SUBST(MOZ_UBSAN)
dnl ========================================================
dnl = Use UndefinedBehavior Sanitizer to find integer overflows
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(signed-overflow-sanitizer,
[ --enable-signed-overflow-sanitizer Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts, default=no)],
MOZ_SIGNED_OVERFLOW_SANITIZE=1,
MOZ_SIGNED_OVERFLOW_SANITIZE= )
MOZ_ARG_ENABLE_BOOL(unsigned-overflow-sanitizer,
[ --enable-unsigned-overflow-sanitizer Enable UndefinedBehavior Sanitizer (Unsigned Integer Overflow Parts, default=no)],
MOZ_UNSIGNED_OVERFLOW_SANITIZE=1,
MOZ_UNSIGNED_OVERFLOW_SANITIZE= )
if test -n "$MOZ_SIGNED_OVERFLOW_SANITIZE$MOZ_UNSIGNED_OVERFLOW_SANITIZE"; then
MOZ_UBSAN=1
SANITIZER_BLACKLISTS=""

View File

@ -195,7 +195,6 @@ def old_configure_options(*options):
'--enable-libproxy',
'--enable-llvm-hacks',
'--enable-logrefcnt',
'--enable-memory-sanitizer',
'--enable-mobile-optimize',
'--enable-necko-wifi',
'--enable-negotiateauth',
@ -215,10 +214,7 @@ def old_configure_options(*options):
'--enable-system-extension-dirs',
'--enable-system-pixman',
'--enable-system-sqlite',
'--enable-thread-sanitizer',
'--enable-signed-overflow-sanitizer',
'--enable-universalchardet',
'--enable-unsigned-overflow-sanitizer',
'--enable-updater',
'--enable-xul',
'--enable-zipwriter',

View File

@ -1596,6 +1596,32 @@ def asan():
add_old_configure_assignment('MOZ_ASAN', asan)
# MSAN
# ==============================================================
js_option('--enable-memory-sanitizer', help='Enable Memory Sanitizer')
@depends(when='--enable-memory-sanitizer')
def msan():
return True
add_old_configure_assignment('MOZ_MSAN', msan)
# TSAN
# ==============================================================
js_option('--enable-thread-sanitizer', help='Enable Thread Sanitizer')
@depends(when='--enable-thread-sanitizer')
def tsan():
return True
add_old_configure_assignment('MOZ_TSAN', tsan)
# UBSAN
# ==============================================================
@ -1617,6 +1643,30 @@ def ubsan(options):
add_old_configure_assignment('MOZ_UBSAN_CHECKS', ubsan)
js_option('--enable-signed-overflow-sanitizer',
help='Enable UndefinedBehavior Sanitizer (Signed Integer Overflow Parts)')
@depends(when='--enable-signed-overflow-sanitizer')
def ub_signed_overflow_san():
return True
add_old_configure_assignment('MOZ_SIGNED_OVERFLOW_SANITIZE', ub_signed_overflow_san)
js_option('--enable-unsigned-overflow-sanitizer',
help='Enable UndefinedBehavior Sanitizer (Unsigned Integer Overflow Parts)')
@depends(when='--enable-unsigned-overflow-sanitizer')
def ub_unsigned_overflow_san():
return True
add_old_configure_assignment('MOZ_UNSIGNED_OVERFLOW_SANITIZE', ub_unsigned_overflow_san)
# Security Hardening
# ==============================================================