mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-06-29 23:36:38 +02:00
Provide --enable-asan and --disable-asan to toggle address sanitizer.
Since we are currently pre-alpha I decided to enable it by default so we as devs don't forget to do so :)
This commit is contained in:
@@ -625,6 +625,7 @@ ac_includes_default="\
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
UNRLINCDIR
|
||||
IRCDLIBS
|
||||
URL
|
||||
PTHREAD_CFLAGS
|
||||
PTHREAD_LIBS
|
||||
@@ -673,7 +674,6 @@ HARDEN_BINCFLAGS
|
||||
HARDEN_LDFLAGS
|
||||
HARDEN_CFLAGS
|
||||
MKPASSWDLIBS
|
||||
IRCDLIBS
|
||||
OBJEXT
|
||||
EXEEXT
|
||||
ac_ct_CC
|
||||
@@ -764,6 +764,7 @@ with_system_cares
|
||||
enable_ssl
|
||||
enable_dynamic_linking
|
||||
enable_werror
|
||||
enable_asan
|
||||
enable_libcurl
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
@@ -1421,6 +1422,8 @@ Optional Features:
|
||||
rather than dynamically (noone knows if disabling
|
||||
dynamic linking actually does anything or not)
|
||||
--enable-werror Turn compilation warnings into errors (-Werror)
|
||||
--disable-asan Disable address sanitizer and other debugging
|
||||
options
|
||||
--enable-libcurl=DIR enable libcurl (remote include) support
|
||||
|
||||
Optional Packages:
|
||||
@@ -3972,7 +3975,6 @@ fi
|
||||
|
||||
|
||||
|
||||
|
||||
# We want to check for compiler flag support, but there is no way to make
|
||||
# clang's "argument unused" warning fatal. So we invoke the compiler through a
|
||||
# wrapper script that greps for this message.
|
||||
@@ -8773,6 +8775,15 @@ else
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-asan was given.
|
||||
if test "${enable_asan+set}" = set; then :
|
||||
enableval=$enable_asan; ac_cv_asan="no"
|
||||
else
|
||||
ac_cv_asan="yes"
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if FD_SETSIZE is large enough to allow $ac_fd file descriptors" >&5
|
||||
$as_echo_n "checking if FD_SETSIZE is large enough to allow $ac_fd file descriptors... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
@@ -10153,6 +10164,13 @@ if test "$ac_cv_werror" = "yes" ; then
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
fi
|
||||
|
||||
if test "$ac_cv_asan" = "yes" ; then
|
||||
CFLAGS="$CFLAGS -O0 -fno-inline -fsanitize=address -fno-omit-frame-pointer -DNOCLOSEFD"
|
||||
IRCDLIBS="-fsanitize=address $IRCDLIBS"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile src/Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/snomasks/Makefile src/modules/extbans/Makefile src/modules/cap/Makefile src/modules/third/Makefile unrealircd"
|
||||
|
||||
+20
-1
@@ -85,7 +85,6 @@ AC_CHECK_LIB(nsl, inet_ntoa,
|
||||
AC_CHECK_LIB(crypto, RAND_egd,
|
||||
AC_DEFINE(HAVE_RAND_EGD, 1, [Define if the libcrypto has RAND_egd]))
|
||||
|
||||
AC_SUBST(IRCDLIBS)
|
||||
AC_SUBST(MKPASSWDLIBS)
|
||||
|
||||
dnl HARDENING START
|
||||
@@ -712,6 +711,18 @@ AC_ARG_ENABLE([werror],
|
||||
[ac_cv_werror="$enableval"],
|
||||
[ac_cv_werror="no"])
|
||||
|
||||
dnl AC_ARG_ENABLE([asan],
|
||||
dnl [AS_HELP_STRING([--enable-asan],
|
||||
dnl [Enable address sanitizer and other debugging options, not recommended for production servers!])],
|
||||
dnl [ac_cv_asan="$enableval"],
|
||||
dnl [ac_cv_asan="no"])
|
||||
|
||||
AC_ARG_ENABLE([asan],
|
||||
[AS_HELP_STRING([--disable-asan],
|
||||
[Disable address sanitizer and other debugging options])],
|
||||
[ac_cv_asan="no"],
|
||||
[ac_cv_asan="yes"])
|
||||
|
||||
AC_MSG_CHECKING([if FD_SETSIZE is large enough to allow $ac_fd file descriptors])
|
||||
AC_COMPILE_IFELSE([
|
||||
#include <sys/types.h>
|
||||
@@ -970,6 +981,14 @@ if test "$ac_cv_werror" = "yes" ; then
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
fi
|
||||
|
||||
dnl Address sanitizer build
|
||||
if test "$ac_cv_asan" = "yes" ; then
|
||||
CFLAGS="$CFLAGS -O0 -fno-inline -fsanitize=address -fno-omit-frame-pointer -DNOCLOSEFD"
|
||||
IRCDLIBS="-fsanitize=address $IRCDLIBS"
|
||||
fi
|
||||
|
||||
AC_SUBST(IRCDLIBS)
|
||||
|
||||
AC_SUBST(UNRLINCDIR)
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
|
||||
Reference in New Issue
Block a user