diff options
author | Zhihao Cheng <chengzhihao1@huawei.com> | 2024-11-11 17:08:30 +0800 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-11-11 10:32:46 +0100 |
commit | e17ffbfb1ab07f8d0d4b864a5f477e119843722d (patch) | |
tree | f9eaa716ab52a8bcd1192966b64ad3ec9769fcb7 /configure.ac | |
parent | 5c0c51078f2b47aca64b4fabdd7c069cb684cad3 (diff) |
Add new option '--asan' for configuration to support dynamic
Address-Sanitizier debugging, which could detect kinds of invalid
memory accessing problems(eg. UAF, r/w OOB, etc.). Currently, only
ubifs-utils(mkfs.ubifs/fsck.ubifs) is supported.
Enable Address-Sanitizier debugging with configuration:
./configure --enable-asan
Notice: The Address-Sanitizier will stop the program and print
problems if memory problems are detected. Sometimes the memory
problems come from third libs(not mtd-utils), which could stuck
the testcases.
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 7b5d609..b160c03 100644 --- a/configure.ac +++ b/configure.ac @@ -105,6 +105,10 @@ AC_ARG_WITH([crypto], [AS_HELP_STRING([--with-crypto], [Support for UBIFS crypto features])], [], [with_crypto="check"]) +AC_ARG_ENABLE([asan], + [AS_HELP_STRING([--enable-asan], [Support AddressSanitizer debug])], + [], [enable_asan="no"]) + ##### search for dependencies ##### need_clock_gettime="no" @@ -146,6 +150,14 @@ AS_IF([test "x$with_zlib" != "xno"], [ [with_zlib="no"])]) ], []) +AC_ARG_VAR([ASAN_LIBS], [linker flags for lasan]) +AS_IF([test "x$enable_asan" = "xyes"], [ + AC_CHECK_LIB([asan], [_init], [ + ASAN_LIBS="-lasan -fsanitize=address -fsanitize-recover=address -g"], [ + AC_MSG_ERROR([cannot find libasan]) + ]) +]) + if test "x$need_uuid" = "xyes"; then PKG_CHECK_MODULES(UUID, [uuid], [], [PKG_CHECK_MODULES_STATIC(UUID, [uuid], [], [uuid_missing="yes"])]) @@ -275,6 +287,7 @@ AM_CONDITIONAL([WITH_XATTR], [test "x$with_xattr" = "xyes"]) AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux" = "xyes"]) AM_CONDITIONAL([WITH_CRYPTO], [test "x$with_crypto" = "xyes"]) AM_CONDITIONAL([WITH_UBIHEALTHD], [test "x$enable_ubihealthd" = "xyes"]) +AM_CONDITIONAL([WITH_ASAN], [test "x$enable_asan" = "xyes"]) AM_CONDITIONAL([BUILD_UBIFS], [test "x$with_ubifs" = "xyes"]) AM_CONDITIONAL([BUILD_JFFSX], [test "x$with_jffs" = "xyes"]) @@ -321,6 +334,7 @@ AC_MSG_RESULT([ compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} + asan debug: ${enable_asan} lzo support: ${with_lzo} zlib support: ${with_zlib} |