[tor-commits] [tor/master] Add --enable-all-bugs-are-fatal option to configure

teor at torproject.org teor at torproject.org
Tue Mar 17 11:09:22 UTC 2020


commit 5591f424753c1f732e4c9d58b31070b878f18484
Author: rl1987 <rl1987 at sdf.lonestar.org>
Date:   Fri Mar 13 20:24:54 2020 +0200

    Add --enable-all-bugs-are-fatal option to configure
    
    This option enables the ALL_BUGS_ARE_FATAL macro.
    
    And use --enable-all-bugs-are-fatal in the Travis configuration.
---
 .travis.yml  | 15 +++++++--------
 configure.ac |  7 +++++++
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 49745278b..77dd78f27 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -93,9 +93,9 @@ matrix:
     #  compiler: clang
     #  os: osx
 
-    - env: ALL_BUGS_ARE_FATAL="yes"
-    - env: ALL_BUGS_ARE_FATAL="yes" SKIP_MAKE_CHECK="yes" CHUTNEY="yes"
-    - env: ALL_BUGS_ARE_FATAL="yes" SKIP_MAKE_CHECK="yes" TEST_STEM="yes"
+    - env: HARDENING_OPTIONS="--enable-assert-fatalism"
+    - env: HARDENING_OPTIONS="--enable-assert-fatalism" SKIP_MAKE_CHECK="yes" CHUTNEY="yes"
+    - env: HARDENING_OPTIONS="--enable-assert-fatalism" SKIP_MAKE_CHECK="yes" TEST_STEM="yes"
 
   ## Allow the build to report success (with non-required sub-builds
   ## continuing to run) if all required sub-builds have succeeded.
@@ -118,9 +118,9 @@ matrix:
     ## chutney tests
     #- env: CHUTNEY_MAKE="test-network-ipv6" CHUTNEY="yes" CHUTNEY_ALLOW_FAILURES="2" SKIP_MAKE_CHECK="yes"
     #  os: osx
-    - env: ALL_BUGS_ARE_FATAL="yes"
-    - env: ALL_BUGS_ARE_FATAL="yes" SKIP_MAKE_CHECK="yes" CHUTNEY="yes"
-    - env: ALL_BUGS_ARE_FATAL="yes" SKIP_MAKE_CHECK="yes" TEST_STEM="yes"
+    - env: HARDENING_OPTIONS="--enable-assert-fatalism"
+    - env: HARDENING_OPTIONS="--enable-assert-fatalism" SKIP_MAKE_CHECK="yes" CHUTNEY="yes"
+    - env: HARDENING_OPTIONS="--enable-assert-fatalism" SKIP_MAKE_CHECK="yes" TEST_STEM="yes"
 
 ## (Linux only) Use a recent Linux image (Ubuntu Bionic)
 dist: bionic
@@ -248,8 +248,7 @@ script:
   - ./autogen.sh
   - CONFIGURE_FLAGS="$ASCIIDOC_OPTIONS $COVERAGE_OPTIONS $HARDENING_OPTIONS $MODULES_OPTIONS $NSS_OPTIONS $OPENSSL_OPTIONS $RUST_OPTIONS --enable-fatal-warnings --disable-silent-rules"
   - echo "Configure flags are $CONFIGURE_FLAGS CC=\"$CC $C_DIALECT_OPTIONS\""
-  - if [[ "$ALL_BUGS_ARE_FATAL" == "" ]]; then ./configure $CONFIGURE_FLAGS CC="$CC $C_DIALECT_OPTIONS"; fi
-  - if [[ "$ALL_BUGS_ARE_FATAL" != "" ]]; then ./configure CFLAGS="-DALL_BUGS_ARE_FATAL" $CONFIGURE_FLAGS CC="$CC $C_DIALECT_OPTIONS"; fi
+  - ./configure $CONFIGURE_FLAGS CC="$CC $C_DIALECT_OPTIONS";
   ## We run `make check` because that's what https://jenkins.torproject.org does.
   - if [[ "$SKIP_MAKE_CHECK" == "" ]]; then make check; fi
   - if [[ "$DISTCHECK" != "" ]]; then make distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS"; fi
diff --git a/configure.ac b/configure.ac
index aa511a391..9d3bef999 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,6 +228,13 @@ if test "x$enable_expensive_hardening" = "xyes" || test "x$enable_fragile_harden
   AC_DEFINE(DEBUG_SMARTLIST, 1, [Enable smartlist debugging])
 fi
 
+AC_ARG_ENABLE(all-bugs-are-fatal,
+   AS_HELP_STRING(--enable-all-bugs-are-fatal, [force all soft asserts in Tor codebase (tor_assert_nonfatal(), BUG(), etc.) to act as hard asserts (tor_assert() and equivalents); makes Tor fragile; only recommended for dev builds]))
+
+if test "x$enable_all_bugs_are_fatal" = "xyes"; then
+  AC_DEFINE(ALL_BUGS_ARE_FATAL, 1, [All assert failures are fatal])
+fi
+
 dnl Linker hardening options
 dnl Currently these options are ELF specific - you can't use this with MacOSX
 AC_ARG_ENABLE(linker-hardening,





More information about the tor-commits mailing list