From 48cc68b69118b3ce8d07fd4f82e00d58667d5379 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 5 Jul 2022 16:23:28 +1000 Subject: [PATCH] Add GCC address sanitizer build/test. --- .github/configs | 25 ++++++++++++++++--------- .github/setup_ci.sh | 2 ++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/configs b/.github/configs index 7ebb832ee..ebbfa5b49 100755 --- a/.github/configs +++ b/.github/configs @@ -42,7 +42,19 @@ case "$config" in CFLAGS="-Wall -Wextra -O2 -Wno-error=implicit-fallthrough -Wno-error=unused-parameter" CONFIGFLAGS="--with-pam --with-Werror" ;; - clang-sanitize-*) + *-sanitize-*) + case "$config" in + gcc-*) + CC=gcc + ;; + clang-*) + # Find the newest available version of clang + for i in `seq 10 99`; do + clang="`which clang-$i 2>/dev/null`" + [ -x "$clang" ] && CC="$clang" + done + ;; + esac # Put Sanitizer logs in regress dir. SANLOGS=`pwd`/regress # - We replace chroot with chdir so that the sanitizer in the preauth @@ -52,11 +64,11 @@ case "$config" in # - openssl and zlib trip ASAN. # - sp_pwdp returned by getspnam trips ASAN, hence disabling shadow. case "$config" in - clang-sanitize-address) + *-sanitize-address) CFLAGS="-fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" - CPPFLAGS='-Dchroot=chdir -Dexplicit_bzero=bzero -DASAN_OPTIONS=\"detect_leaks=0:log_path='$SANLOGS'/asan.log\"' - CONFIGFLAGS="--without-openssl --without-zlib --without-shadow" + CPPFLAGS='-Dchroot=chdir -Dexplicit_bzero=bzero -D_FORTIFY_SOURCE=0 -DASAN_OPTIONS=\"detect_leaks=0:log_path='$SANLOGS'/asan.log\"' + CONFIGFLAGS="" TEST_TARGET="t-exec" ;; clang-sanitize-memory) @@ -74,11 +86,6 @@ case "$config" in echo unknown sanitize option; exit 1;; esac - # Find the newest available version of clang - for i in `seq 10 99`; do - clang=$(which clang-$i 2>/dev/null) - [ -x "$clang" ] && CC="$clang" - done features="--disable-security-key --disable-pkcs11" hardening="--without-sandbox --without-hardening --without-stackprotect" privsep="--with-privsep-user=root" diff --git a/.github/setup_ci.sh b/.github/setup_ci.sh index cd8b72d20..fe5e13ff0 100755 --- a/.github/setup_ci.sh +++ b/.github/setup_ci.sh @@ -40,6 +40,8 @@ for TARGET in $TARGETS; do clang-sanitize*) PACKAGES="$PACKAGES clang-12" ;; + gcc-sanitize*) + ;; clang-*|gcc-*) compiler=$(echo $TARGET | sed 's/-Werror//') PACKAGES="$PACKAGES $compiler" -- 2.47.3