diff options
author | Reiner Herrmann <reiner@reiner-h.de> | 2021-10-11 22:47:30 +0200 |
---|---|---|
committer | Reiner Herrmann <reiner@reiner-h.de> | 2021-10-11 22:47:30 +0200 |
commit | 351ab1ca3f606eed1dd84bc761e37e456c7ac552 (patch) | |
tree | 8cf5d064559b7a3eefd2e08f100fc3f16b4b0a2d | |
parent | Update configure with asan flag (diff) | |
download | firejail-asan.tar.gz firejail-asan.tar.zst firejail-asan.zip |
Allow selection of sanitizerasan
-rwxr-xr-x | configure | 54 | ||||
-rw-r--r-- | configure.ac | 14 |
2 files changed, 54 insertions, 14 deletions
@@ -711,7 +711,7 @@ ac_subst_files='' | |||
711 | ac_user_opts=' | 711 | ac_user_opts=' |
712 | enable_option_checking | 712 | enable_option_checking |
713 | enable_analyzer | 713 | enable_analyzer |
714 | enable_asan | 714 | enable_sanitizer |
715 | enable_apparmor | 715 | enable_apparmor |
716 | enable_selinux | 716 | enable_selinux |
717 | enable_dbusproxy | 717 | enable_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 | ||
3297 | fi | 3298 | fi |
3298 | 3299 | ||
3299 | # Check whether --enable-asan was given. | 3300 | # Check whether --enable-sanitizer was given. |
3300 | if test "${enable_asan+set}" = set; then : | 3301 | if test "${enable_sanitizer+set}" = set; then : |
3301 | enableval=$enable_asan; | 3302 | enableval=$enable_sanitizer; |
3302 | fi | 3303 | fi |
3303 | 3304 | ||
3304 | if test "x$enable_asan" = "xyes"; then : | 3305 | if 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; } | ||
3309 | if eval \${$as_CACHEVAR+:} false; then : | ||
3310 | $as_echo_n "(cached) " >&6 | ||
3311 | else | ||
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 | |||
3318 | int | ||
3319 | main () | ||
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 | ||
3326 | if ac_fn_c_try_compile "$LINENO"; then : | ||
3327 | eval "$as_CACHEVAR=yes" | ||
3328 | else | ||
3329 | eval "$as_CACHEVAR=no" | ||
3330 | fi | ||
3331 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext | ||
3332 | CFLAGS=$ax_check_save_flags | ||
3333 | fi | ||
3334 | eval ac_res=\$$as_CACHEVAR | ||
3335 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 | ||
3336 | $as_echo "$ac_res" >&6; } | ||
3337 | if 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 | |||
3342 | else | ||
3343 | as_fn_error $? "$enable_sanitizer sanitizer not supported" "$LINENO" 5 | ||
3344 | |||
3345 | fi | ||
3308 | 3346 | ||
3309 | fi | 3347 | fi |
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 | ||
48 | AC_ARG_ENABLE([asan], | 48 | AC_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)])) |
50 | AS_IF([test "x$enable_asan" = "xyes"], [ | 50 | AS_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 | ||
55 | HAVE_APPARMOR="" | 57 | HAVE_APPARMOR="" |
56 | AC_ARG_ENABLE([apparmor], | 58 | AC_ARG_ENABLE([apparmor], |