aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Reiner Herrmann <reiner@reiner-h.de>2021-10-11 22:47:30 +0200
committerLibravatar Reiner Herrmann <reiner@reiner-h.de>2021-10-11 22:47:30 +0200
commit351ab1ca3f606eed1dd84bc761e37e456c7ac552 (patch)
tree8cf5d064559b7a3eefd2e08f100fc3f16b4b0a2d
parentUpdate configure with asan flag (diff)
downloadfirejail-asan.tar.gz
firejail-asan.tar.zst
firejail-asan.zip
Allow selection of sanitizerasan
-rwxr-xr-xconfigure54
-rw-r--r--configure.ac14
2 files changed, 54 insertions, 14 deletions
diff --git a/configure b/configure
index ab6a24b89..a4cb0f6b6 100755
--- a/configure
+++ b/configure
@@ -711,7 +711,7 @@ ac_subst_files=''
711ac_user_opts=' 711ac_user_opts='
712enable_option_checking 712enable_option_checking
713enable_analyzer 713enable_analyzer
714enable_asan 714enable_sanitizer
715enable_apparmor 715enable_apparmor
716enable_selinux 716enable_selinux
717enable_dbusproxy 717enable_dbusproxy
@@ -1369,7 +1369,8 @@ Optional Features:
1369 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) 1369 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
1370 --enable-FEATURE[=ARG] include FEATURE [ARG=yes] 1370 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1371 --enable-analyzer enable GCC static analyzer 1371 --enable-analyzer enable GCC static analyzer
1372 --enable-asan enable address sanitizer 1372 --enable-sanitizer=[address,memory,undefined]
1373 enable address/memory/undefined sanitizer (debug)
1373 --enable-apparmor enable apparmor 1374 --enable-apparmor enable apparmor
1374 --enable-selinux SELinux labeling support 1375 --enable-selinux SELinux labeling support
1375 --disable-dbusproxy disable dbus proxy 1376 --disable-dbusproxy disable dbus proxy
@@ -3296,15 +3297,52 @@ if test "x$enable_analyzer" = "xyes"; then :
3296 3297
3297fi 3298fi
3298 3299
3299# Check whether --enable-asan was given. 3300# Check whether --enable-sanitizer was given.
3300if test "${enable_asan+set}" = set; then : 3301if test "${enable_sanitizer+set}" = set; then :
3301 enableval=$enable_asan; 3302 enableval=$enable_sanitizer;
3302fi 3303fi
3303 3304
3304if test "x$enable_asan" = "xyes"; then : 3305if test "x$enable_sanitizer" = "xaddress" -o "x$enable_sanitizer" = "xmemory" -o "x$enable_sanitizer" = "xundefined"; then :
3306 as_CACHEVAR=`$as_echo "ax_cv_check_cflags__-fsanitize=$enable_sanitizer" | $as_tr_sh`
3307{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fsanitize=$enable_sanitizer" >&5
3308$as_echo_n "checking whether C compiler accepts -fsanitize=$enable_sanitizer... " >&6; }
3309if eval \${$as_CACHEVAR+:} false; then :
3310 $as_echo_n "(cached) " >&6
3311else
3312
3313 ax_check_save_flags=$CFLAGS
3314 CFLAGS="$CFLAGS -fsanitize=$enable_sanitizer"
3315 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3316/* end confdefs.h. */
3317
3318int
3319main ()
3320{
3305 3321
3306 EXTRA_CFLAGS="$EXTRA_CFLAGS -fsanitize=address -fno-omit-frame-pointer" 3322 ;
3307 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fsanitize=address" 3323 return 0;
3324}
3325_ACEOF
3326if ac_fn_c_try_compile "$LINENO"; then :
3327 eval "$as_CACHEVAR=yes"
3328else
3329 eval "$as_CACHEVAR=no"
3330fi
3331rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3332 CFLAGS=$ax_check_save_flags
3333fi
3334eval ac_res=\$$as_CACHEVAR
3335 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
3336$as_echo "$ac_res" >&6; }
3337if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then :
3338
3339 EXTRA_CFLAGS="$EXTRA_CFLAGS -fsanitize=$enable_sanitizer -fno-omit-frame-pointer"
3340 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fsanitize=$enable_sanitizer"
3341
3342else
3343 as_fn_error $? "$enable_sanitizer sanitizer not supported" "$LINENO" 5
3344
3345fi
3308 3346
3309fi 3347fi
3310 3348
diff --git a/configure.ac b/configure.ac
index 99aca3c0c..05ade0931 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,12 +45,14 @@ AS_IF([test "x$enable_analyzer" = "xyes"], [
45 EXTRA_CFLAGS="$EXTRA_CFLAGS -fanalyzer -Wno-analyzer-malloc-leak" 45 EXTRA_CFLAGS="$EXTRA_CFLAGS -fanalyzer -Wno-analyzer-malloc-leak"
46]) 46])
47 47
48AC_ARG_ENABLE([asan], 48AC_ARG_ENABLE([sanitizer],
49 AS_HELP_STRING([--enable-asan], [enable address sanitizer])) 49 AS_HELP_STRING([--enable-sanitizer=@<:@address,memory,undefined@:>@], [enable address/memory/undefined sanitizer (debug)]))
50AS_IF([test "x$enable_asan" = "xyes"], [ 50AS_IF([test "x$enable_sanitizer" = "xaddress" -o "x$enable_sanitizer" = "xmemory" -o "x$enable_sanitizer" = "xundefined"],
51 EXTRA_CFLAGS="$EXTRA_CFLAGS -fsanitize=address -fno-omit-frame-pointer" 51 [AX_CHECK_COMPILE_FLAG([-fsanitize=$enable_sanitizer],[
52 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fsanitize=address" 52 EXTRA_CFLAGS="$EXTRA_CFLAGS -fsanitize=$enable_sanitizer -fno-omit-frame-pointer"
53]) 53 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fsanitize=$enable_sanitizer"
54],[AC_MSG_ERROR([$enable_sanitizer sanitizer not supported])]
55)])
54 56
55HAVE_APPARMOR="" 57HAVE_APPARMOR=""
56AC_ARG_ENABLE([apparmor], 58AC_ARG_ENABLE([apparmor],