diff --git a/configure b/configure index 5b09de36f9a0b8..1f17eb75a251e0 100755 --- a/configure +++ b/configure @@ -13376,12 +13376,16 @@ then : printf "%s\n" "$withval" >&6; } BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS" LDFLAGS="-fsanitize=address $LDFLAGS" +with_asan="yes" # ASan works by controlling memory allocation, our own malloc interferes. with_pymalloc="no" else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } ;; + e) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +with_asan="no" + ;; esac fi @@ -13433,6 +13437,7 @@ then : BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS" LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS" +with_msan="yes" else case e in #( e) as_fn_error $? "The selected compiler doesn't support memory sanitizer" "$LINENO" 5 ;; @@ -13441,10 +13446,14 @@ fi # MSan works by controlling memory allocation, our own malloc interferes. with_pymalloc="no" +with_msan="no" else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } ;; + e) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +with_msan="no" + ;; esac fi @@ -16132,6 +16141,11 @@ fi +if test "$with_msan" == "yes" || "$with_ubsan" == "yes" || "$with_tsan" == "yes"; +then + HAVE_CARGO="no" +fi + @@ -36187,3 +36201,4 @@ if test "$ac_cv_header_stdatomic_h" != "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Your compiler or platform does have a working C11 stdatomic.h. A future version of Python may require stdatomic.h." >&5 printf "%s\n" "$as_me: Your compiler or platform does have a working C11 stdatomic.h. A future version of Python may require stdatomic.h." >&6;} fi + diff --git a/configure.ac b/configure.ac index 1561c6f9b2e99f..147adaa9b5683a 100644 --- a/configure.ac +++ b/configure.ac @@ -3316,10 +3316,14 @@ AC_ARG_WITH([address_sanitizer], AC_MSG_RESULT([$withval]) BASECFLAGS="-fsanitize=address -fno-omit-frame-pointer $BASECFLAGS" LDFLAGS="-fsanitize=address $LDFLAGS" +with_asan="yes" # ASan works by controlling memory allocation, our own malloc interferes. with_pymalloc="no" ], -[AC_MSG_RESULT([no])]) +[ +AC_MSG_RESULT([no]) +with_asan="no" +]) AC_MSG_CHECKING([for --with-memory-sanitizer]) AC_ARG_WITH( @@ -3333,11 +3337,16 @@ AC_MSG_RESULT([$withval]) AX_CHECK_COMPILE_FLAG([-fsanitize=memory],[ BASECFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer $BASECFLAGS" LDFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 $LDFLAGS" +with_msan="yes" ],[AC_MSG_ERROR([The selected compiler doesn't support memory sanitizer])]) # MSan works by controlling memory allocation, our own malloc interferes. with_pymalloc="no" +with_msan="no" ], -[AC_MSG_RESULT([no])]) +[ +AC_MSG_RESULT([no]) +with_msan="no" +]) AC_MSG_CHECKING([for --with-undefined-behavior-sanitizer]) AC_ARG_WITH( @@ -4355,6 +4364,14 @@ AC_SUBST([CARGO_TARGET_DIR]) AC_SUBST([CARGO_PROFILE]) AC_SUBST([CARGO_TARGET]) +dnl do not enable Rust code if certain sanitizers are enabled +dnl asan works fine, but msan requires the entire binary to be instrumented +dnl ubsan and tsan cause the bindings generation to fail, so they are disabled for now +if test "$with_msan" == "yes" || "$with_ubsan" == "yes" || "$with_tsan" == "yes"; +then + HAVE_CARGO="no" +fi + dnl detect sqlite3 from Emscripten emport PY_CHECK_EMSCRIPTEN_PORT([LIBSQLITE3], [-sUSE_SQLITE3])