From f5a5dae4aac30d82bf9e4c055f422294585cdf30 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 17 Oct 2025 09:20:12 +0200 Subject: [PATCH] Make sanitizer question in ./Config not only enable ASan but also UBSan (both AddressSanitizer and UndefinedBehaviorSanitizer) This previously helped finding 8c26cec5fca4a17d42fef04ab0e0a179bd4a0ccd Also update the ./Config text a bit, eg about ASan not running OK on FreeBSD, which only affects <14.2 as per https://bugs.unrealircd.org/view.php?id=6470#c23412 --- Config | 14 +++++++------- configure | 2 +- configure.ac | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Config b/Config index 782f2aaa1..173ab0a9b 100755 --- a/Config +++ b/Config @@ -847,13 +847,13 @@ while [ -z "$TEST" ] ; do fi echo "" echo "Are you running UnrealIRCd as a test, debugging a problem or developing a module?" - echo "Then it is possible to run with AddressSanitizer enabled. This will make it" - echo "catch bugs such as out-of-bounds and other memory corruption issues, which can" - echo "be really helpful in some cases. The downside is that it will consume a lot" - echo "more memory and run slower too. So, only answer 'Yes' if you are OK with this." - echo "Also, on some systems (notably FreeBSD), when you enable AddressSanitizer," - echo "UnrealIRCd may fail to start. So when in doubt, answer 'No'." - echo "Do you want to enable AddressSanitizer?" + echo "Then it is possible to run with AddressSanitizer and UndefinedBehaviorSanitizer" + echo "enabled. This will catch bugs, such as out-of-bounds and other memory corruption" + echo "issues, which can be really helpful in some cases. The downside is that it will" + echo "consume a lot more memory and run slower too. So, only answer 'Yes' if you are" + echo "OK with this. Also, on some systems (notably FreeBSD <14.2), when you enable" + echo "this UnrealIRCd may fail to start. So when in doubt, answer 'No'." + echo "Do you want to enable AddressSanitizer & UndefinedBehaviorSanitizer?" echo $n "[$TEST] -> $c" read cc if [ -z "$cc" ] ; then diff --git a/configure b/configure index 219539561..d54631eb9 100755 --- a/configure +++ b/configure @@ -10108,7 +10108,7 @@ if test "$ac_cv_werror" = "yes" ; then fi if test "$ac_cv_asan" = "yes" ; then - CFLAGS="$CFLAGS -O2 -fno-inline -fsanitize=address -fno-omit-frame-pointer -DNOCLOSEFD" + CFLAGS="$CFLAGS -O2 -fno-inline -fsanitize=address,undefined -fno-omit-frame-pointer -DNOCLOSEFD" IRCDLIBS="-fsanitize=address $IRCDLIBS" fi diff --git a/configure.ac b/configure.ac index 63a6d40d0..ab67ab243 100644 --- a/configure.ac +++ b/configure.ac @@ -918,7 +918,7 @@ fi dnl Address sanitizer build if test "$ac_cv_asan" = "yes" ; then - CFLAGS="$CFLAGS -O2 -fno-inline -fsanitize=address -fno-omit-frame-pointer -DNOCLOSEFD" + CFLAGS="$CFLAGS -O2 -fno-inline -fsanitize=address,undefined -fno-omit-frame-pointer -DNOCLOSEFD" IRCDLIBS="-fsanitize=address $IRCDLIBS" fi