]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
hardening: enable address sanitizer build 2907/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 12 Mar 2019 19:58:09 +0000 (20:58 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 12 Mar 2019 20:01:02 +0000 (21:01 +0100)
This adds --{disable,enable}-asan. It is disabled by default.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
configure.ac
src/lxc/Makefile.am

index 3abee054f754c5342ef2dcd9299e1bdaefa82e35..9d07dbc027407e28de1f19b0a560d55c69beb3be 100644 (file)
@@ -428,6 +428,12 @@ AC_ARG_ENABLE([commands],
        [], [enable_commands=yes])
 AM_CONDITIONAL([ENABLE_COMMANDS], [test "x$enable_commands" = "xyes"])
 
+# Build with ASAN commands
+AC_ARG_ENABLE([asan],
+       [AC_HELP_STRING([--enable-asan], [build with address sanitizer enabled [default=no]])],
+       [], [enable_asan=no])
+AM_CONDITIONAL([ENABLE_ASAN], [test "x$enable_asan" = "xyes"])
+
 # Optional test binaries
 AC_ARG_ENABLE([tests],
        [AC_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])],
@@ -1001,6 +1007,7 @@ Documentation:
 
 Debugging:
  - tests: $enable_tests
+ - ASAN: $enable_asan
  - mutex debugging: $enable_mutex_debugging
 
 Paths:
index 538201b517cdbdd05e3c38f2005ad19a6ac28a2f..b868d530eb56bf36c71a5eba4daf9a16bffb7fdd 100644 (file)
@@ -235,6 +235,10 @@ liblxc_la_CFLAGS = -fPIC \
                   -DPIC \
                   $(AM_CFLAGS) \
                   -pthread
+if ENABLE_ASAN
+liblxc_la_CFLAGS += -fsanitize=address \
+                   -fno-omit-frame-pointer
+endif
 
 liblxc_la_LDFLAGS = -pthread \
                    -Wl,-no-undefined \