travis: enable -fsanitize=undefined

parent 619670be
...@@ -6,22 +6,7 @@ before_install: ...@@ -6,22 +6,7 @@ before_install:
- sudo add-apt-repository ppa:ubuntu-lxc/daily -y - sudo add-apt-repository ppa:ubuntu-lxc/daily -y
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq coccinelle parallel libapparmor-dev libcap-dev libseccomp-dev python3-dev python3-setuptools docbook2x libgnutls-dev libselinux1-dev linux-libc-dev - sudo apt-get install -qq coccinelle parallel libapparmor-dev libcap-dev libseccomp-dev python3-dev python3-setuptools docbook2x libgnutls-dev libselinux1-dev linux-libc-dev
script: script: src/tests/travis.sh
- ./coccinelle/run-coccinelle.sh -i
- git diff --exit-code
- export CFLAGS="-Wall -Werror"
- export LDFLAGS="-pthread -lpthread"
- ./autogen.sh
- rm -Rf build
- mkdir build
- cd build
- ../configure --enable-tests --with-distro=unknown
- make -j4
- make DESTDIR=$TRAVIS_BUILD_DIR/install install
- cd ../config/apparmor
- ./lxc-generate-aa-rules.py container-rules.base > /tmp/output
- diff /tmp/output container-rules
notifications: notifications:
email: email:
recipients: recipients:
......
...@@ -438,6 +438,12 @@ AC_ARG_ENABLE([asan], ...@@ -438,6 +438,12 @@ AC_ARG_ENABLE([asan],
[enable_asan=$enableval], [enable_asan=no]) [enable_asan=$enableval], [enable_asan=no])
AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"]) AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"])
# Build with UBSAN commands
AC_ARG_ENABLE([ubsan],
[AS_HELP_STRING([--enable-ubsan], [build with ubsan sanitizer enabled [default=no]])],
[enable_asan=$enableval], [enable_ubsan=no])
AM_CONDITIONAL([ENABLE_UBSAN], [test "x$enable_ubsan" = "xyes"])
# Optional test binaries # Optional test binaries
AC_ARG_ENABLE([tests], AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])], [AS_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])],
......
...@@ -232,12 +232,17 @@ endif ...@@ -232,12 +232,17 @@ endif
liblxc_la_CFLAGS = -fPIC \ liblxc_la_CFLAGS = -fPIC \
-DPIC \ -DPIC \
$(AM_CFLAGS) \ $(AM_CFLAGS) \
$(LIBLXC_SANITIZER) \
-pthread -pthread
if ENABLE_ASAN if ENABLE_ASAN
liblxc_la_CFLAGS += -fsanitize=address \ liblxc_la_CFLAGS += -fsanitize=address \
-fno-omit-frame-pointer -fno-omit-frame-pointer
endif endif
if ENABLE_UBSAN
liblxc_la_CFLAGS += -fsanitize=undefined
endif
liblxc_la_LDFLAGS = -pthread \ liblxc_la_LDFLAGS = -pthread \
-Wl,-no-undefined \ -Wl,-no-undefined \
-Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \ -Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \
......
#! /bin/bash
set -e
./coccinelle/run-coccinelle.sh -i
git diff --exit-code
export CFLAGS="-Wall -Werror"
export LDFLAGS="-pthread -lpthread"
./autogen.sh
rm -Rf build
mkdir build
cd build
if [ "$CC_FOR_BUILD" == "gcc" ]; then
../configure --enable-tests --enable-ubsan --with-distro=unknown
else
../configure --enable-tests --with-distro=unknown
fi
make -j4
make DESTDIR="$TRAVIS_BUILD_DIR"/install install
cd ../config/apparmor
./lxc-generate-aa-rules.py container-rules.base > /tmp/output
diff /tmp/output container-rules
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