From 99108df7afc086ecde40d0e42dec253b68fea7ed Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 15 May 2020 08:25:57 +0300 Subject: Add more sanitize flags --- configure | 387 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- configure.ac | 8 ++ 2 files changed, 394 insertions(+), 1 deletion(-) diff --git a/configure b/configure index e3a8cc99a..a8ca071cb 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac 7c9af5bf8. +# From configure.ac 2b51b41ab. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -6308,6 +6308,391 @@ $as_echo "no" >&6; } LDFLAGS="$OLD_LDFLAGS" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=address-use-after-scope" >&5 +$as_echo_n "checking whether $CC supports -fsanitize=address-use-after-scope... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=address-use-after-scope" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=address-use-after-scope" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=address-use-after-scope" >&5 +$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=address-use-after-scope... " >&6; } + CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=pointer-overflow" >&5 +$as_echo_n "checking whether $CC supports -fsanitize=pointer-overflow... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=pointer-overflow" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=pointer-overflow" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=pointer-overflow" >&5 +$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=pointer-overflow... " >&6; } + CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=builtin" >&5 +$as_echo_n "checking whether $CC supports -fsanitize=builtin... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=builtin" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=builtin" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=builtin" >&5 +$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=builtin... " >&6; } + CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=pointer-compare" >&5 +$as_echo_n "checking whether $CC supports -fsanitize=pointer-compare... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=pointer-compare" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=pointer-compare" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=pointer-compare" >&5 +$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=pointer-compare... " >&6; } + CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=pointer-subtract" >&5 +$as_echo_n "checking whether $CC supports -fsanitize=pointer-subtract... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=pointer-subtract" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=pointer-subtract" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=pointer-subtract" >&5 +$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=pointer-subtract... " >&6; } + CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=shift-exponent" >&5 +$as_echo_n "checking whether $CC supports -fsanitize=shift-exponent... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=shift-exponent" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=shift-exponent" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=shift-exponent" >&5 +$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=shift-exponent... " >&6; } + CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=shift-base" >&5 +$as_echo_n "checking whether $CC supports -fsanitize=shift-base... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=shift-base" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=shift-base" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=shift-base" >&5 +$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=shift-base... " >&6; } + CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fsanitize=sanitize-address-use-after-scope" >&5 +$as_echo_n "checking whether $CC supports -fsanitize=sanitize-address-use-after-scope... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fsanitize=sanitize-address-use-after-scope" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fsanitize=sanitize-address-use-after-scope" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=sanitize-address-use-after-scope" >&5 +$as_echo_n "checking whether $CC requires -fsanitize-undefined-trap-on-error for -fsanitize=sanitize-address-use-after-scope... " >&6; } + CFLAGS="$CFLAGS -fsanitize-undefined-trap-on-error" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + + fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext diff --git a/configure.ac b/configure.ac index df3da8266..1d02fdf79 100644 --- a/configure.ac +++ b/configure.ac @@ -994,6 +994,14 @@ if test "$enable_sanitize" != "no" ; then AC_CHECK_SANITIZER_FLAG(bool) AC_CHECK_SANITIZER_FLAG(enum) AC_CHECK_SANITIZER_FLAG(vptr) + AC_CHECK_SANITIZER_FLAG(address-use-after-scope) + AC_CHECK_SANITIZER_FLAG(pointer-overflow) + AC_CHECK_SANITIZER_FLAG(builtin) + AC_CHECK_SANITIZER_FLAG(pointer-compare) + AC_CHECK_SANITIZER_FLAG(pointer-subtract) + AC_CHECK_SANITIZER_FLAG(shift-exponent) + AC_CHECK_SANITIZER_FLAG(shift-base) + AC_CHECK_SANITIZER_FLAG(sanitize-address-use-after-scope) fi fi -- cgit v1.2.3-70-g09d2