Unverified Commit 12cf9f5a by Christian Brauner Committed by GitHub

Merge pull request #3801 from evverx/san-tweaks

ci: make use of --enable-sanitizers instead of CFLAGS
parents 6622f651 d480165a
...@@ -20,18 +20,8 @@ apt-get install --yes --no-install-recommends \ ...@@ -20,18 +20,8 @@ apt-get install --yes --no-install-recommends \
python3-setuptools rsync squashfs-tools uidmap unzip uuid-runtime \ python3-setuptools rsync squashfs-tools uidmap unzip uuid-runtime \
wget xz-utils wget xz-utils
# init.lxc.static is run in arbitrary containers where the libasan library lxc has been built with
# isn't always installed. To make it work let's override GCC's default and link both libasan
# and libubsan statically. It should help to fix issues like
# ...
# ++ lxc-execute -n c1 -- sudo -u ubuntu /nnptest
# lxc-init: error while loading shared libraries: libasan.so.5: cannot open shared object file: No such file or directory
if [[ "$CC" == "gcc" ]]; then
sed -i '/init_lxc_static_LDFLAGS/s/$/ -static-libasan -static-libubsan/' src/lxc/Makefile.am
fi
./autogen.sh ./autogen.sh
CFLAGS="-Wall -Werror -fsanitize=address,undefined" ./configure --enable-tests --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/ --disable-no-undefined CFLAGS="-Wall -Werror" ./configure --enable-sanitizers --enable-tests --prefix=/usr/ --sysconfdir=/etc/ --localstatedir=/var/ --disable-no-undefined
make make
make install make install
......
...@@ -70,7 +70,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [ ...@@ -70,7 +70,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [
AS_TR_SH([cc_cv_ldflags_$1]), AS_TR_SH([cc_cv_ldflags_$1]),
[ac_save_LDFLAGS="$LDFLAGS" [ac_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $1" LDFLAGS="$LDFLAGS $1"
AC_LINK_IFELSE([int main() { return 1; }], AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])],
[eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_ldflags_$1])="]) [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
LDFLAGS="$ac_save_LDFLAGS" LDFLAGS="$ac_save_LDFLAGS"
......
...@@ -471,11 +471,6 @@ if test "x$enable_sanitizers" = "xyes"; then ...@@ -471,11 +471,6 @@ if test "x$enable_sanitizers" = "xyes"; then
-fno-omit-frame-pointer]) -fno-omit-frame-pointer])
AC_SUBST(AM_CFLAGS) AC_SUBST(AM_CFLAGS)
CC_CHECK_FLAGS_APPEND([AM_LDFLAGS],[LDFLAGS],[ \
-fsanitize=address])
AC_SUBST(AM_LDFLAGS)
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
......
...@@ -1827,6 +1827,9 @@ endif ...@@ -1827,6 +1827,9 @@ endif
init_lxc_static_LDFLAGS = -all-static -pthread init_lxc_static_LDFLAGS = -all-static -pthread
init_lxc_static_LDADD = @CAP_LIBS@ init_lxc_static_LDADD = @CAP_LIBS@
init_lxc_static_CFLAGS = $(AM_CFLAGS) -DNO_LXC_CONF init_lxc_static_CFLAGS = $(AM_CFLAGS) -DNO_LXC_CONF
if ENABLE_SANITIZERS
init_lxc_static_CFLAGS += -fno-sanitize=address,undefined
endif
endif endif
endif endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment