On 04/07/22 11:42, Richard W.M. Jones wrote:
This flag allows you to disable the linker script (for the server
only). This is necessary for ASAN to work, and the documentation has
been updated to explain how to run nbdkit under ASAN.
Thanks Eric Blake for helping me with working out the root cause.
---
configure.ac | 7 +++++++
README | 13 +++++++++++++
2 files changed, 20 insertions(+)
diff --git a/configure.ac b/configure.ac
index ba194781..404d4e23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -700,6 +700,13 @@ AS_IF([test "x$enable_libfuzzer" = "xyes"],[
])
AM_CONDITIONAL([ENABLE_LIBFUZZER],[test "x$enable_libfuzzer" =
"xyes"])
+dnl Should we use the linker script with the server? Note
+dnl some tests above may set this variable.
+AC_ARG_ENABLE([linker-script],
+ [AS_HELP_STRING([--disable-linker-script],
+ [disable linker script for server (developers only)])],
+ [use_linker_script_for_server=$enableval],
+ [])
AM_CONDITIONAL([USE_LINKER_SCRIPT_FOR_SERVER],
[test "x$use_linker_script_for_server" = "xyes"])
diff --git a/README b/README
index 3480d561..7aa93b1d 100644
--- a/README
+++ b/README
@@ -324,6 +324,19 @@ For further information, see:
https://libguestfs.org/
https://github.com/NetworkBlockDevice/nbd/blob/master/doc/proto.md
+Address sanitizer (ASAN)
+------------------------
+
+You can compile nbdkit with clang and ASAN with:
+
+ ./configure CC=clang CXX=clang++ \
+ CFLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" \
+ --disable-linker-script \
+ --disable-golang
+ make clean
+ make
+ ASAN_OPTIONS="allocator_may_return_null=1 detect_leaks=false" make check
+
Test coverage
-------------