Skip to content

Commit

Permalink
hardening: enable address sanitizer build
Browse files Browse the repository at this point in the history
This adds --{disable,enable}-asan. It is disabled by default.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Mar 12, 2019
1 parent 45265bf commit 565c442
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions configure.ac
Expand Up @@ -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]])],
Expand Down Expand Up @@ -1001,6 +1007,7 @@ Documentation:

Debugging:
- tests: $enable_tests
- ASAN: $enable_asan
- mutex debugging: $enable_mutex_debugging

Paths:
Expand Down
4 changes: 4 additions & 0 deletions src/lxc/Makefile.am
Expand Up @@ -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 \
Expand Down

0 comments on commit 565c442

Please sign in to comment.