From: Jorge Pereira Date: Wed, 9 Sep 2020 18:11:29 +0000 (-0300) Subject: configure: Add sanitizer fuzzer support X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49697799fed3d2e47eef8a9064d0b699fda96f78;p=thirdparty%2Ffreeradius-server.git configure: Add sanitizer fuzzer support --- diff --git a/configure b/configure index 8e76e71ec96..635f599851c 100755 --- a/configure +++ b/configure @@ -747,6 +747,7 @@ enable_verify_ptr enable_largefile enable_strict_dependencies enable_werror +enable_llvm_fuzzer_sanitizer enable_llvm_address_sanitizer enable_llvm_leak_sanitizer enable_llvm_undefined_behaviour_sanitizer @@ -1426,6 +1427,9 @@ Optional Features: --disable-largefile omit support for large files --enable-strict-dependencies fail configure on lack of module dependancy. --enable-werror causes the build to fail if any warnings are generated. + --enable-llvm-fuzzer-sanitizer + build with support for LLVM's fuzzer sanitizer (if + building with clang). --enable-llvm-address-sanitizer build with support for LLVM's address sanitizer (if building with clang). @@ -5791,6 +5795,19 @@ if test "${enable_werror+set}" = set; then : fi +# Check whether --enable-llvm-fuzzer-sanitizer was given. +if test "${enable_llvm_fuzzer_sanitizer+set}" = set; then : + enableval=$enable_llvm_fuzzer_sanitizer; case "$enableval" in + no) + llvm_fuzzer_sanitizer=no + ;; + *) + llvm_fuzzer_sanitizer=yes + esac + +fi + + # Check whether --enable-llvm-address-sanitizer was given. if test "${enable_llvm_address_sanitizer+set}" = set; then : enableval=$enable_llvm_address_sanitizer; case "$enableval" in @@ -13246,6 +13263,10 @@ $as_echo "$ax_cv_cc_wimplicit_fallthrough_flag" >&6; } fsanitizeflags= + if test "x$llvm_fuzzer_sanitizer" = "xyes" && test "x$ax_cv_cc_clang" = "xyes"; then + fsanitizeflags="$fsanitizeflags,fuzzer" + fi + if test "x$llvm_address_sanitizer" = "xyes" && test "x$ax_cv_cc_clang" = "xyes"; then devcflags="$devcflags -fno-omit-frame-pointer -fno-optimize-sibling-calls" diff --git a/configure.ac b/configure.ac index 5921606197e..f88f91f8fa5 100644 --- a/configure.ac +++ b/configure.ac @@ -352,6 +352,22 @@ AC_ARG_ENABLE(werror, esac ] ) +dnl # +dnl # Enable the -fsanitize=fuzzer and link in the address sanitizer +dnl # libraries. +dnl # +AC_ARG_ENABLE(llvm-fuzzer-sanitizer, +[AS_HELP_STRING([--enable-llvm-fuzzer-sanitizer], + [build with support for LLVM's fuzzer sanitizer (if building with clang).])], +[ case "$enableval" in + no) + llvm_fuzzer_sanitizer=no + ;; + *) + llvm_fuzzer_sanitizer=yes + esac ] +) + dnl # dnl # Enable the -fsanitize=address and link in the address sanitizer dnl # libraries. @@ -1752,6 +1768,16 @@ if test "x$developer" = "xyes"; then dnl # fsanitizeflags= + dnl # + dnl # If running with clang, add in FUZZER + dnl # + if test "x$llvm_fuzzer_sanitizer" = "xyes" && test "x$ax_cv_cc_clang" = "xyes"; then + dnl # + dnl # -fsanitize=fuzzer - Build with fuzzer support + dnl # + fsanitizeflags="$fsanitizeflags,fuzzer" + fi + dnl # dnl # If running with clang, add in ASAN dnl #