summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej@ahunt.org>2021-02-27 14:21:56 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-02-28 19:46:58 +0100
commit44b36a0602b04342566362bce3f6bed7d2b096e4 (patch)
treedca802aed08d9daf04369a131777dea3877ca52c /configure.ac
parent06c3eafce490fbfb8f8c477cb8dfe7f83e1fca9c (diff)
Upgrade fuzzers to LIB_FUZZING_ENGINE
And check that LIB_FUZZING_ENGINE is set during configure. Because: 1. It's easier to build locally this way (you don't need to build or hack a libFuzzingEngine.a - instead you can just specify LIB_FUZZING_ENGINE=-fsanitize=fuzzer to produce a valid build). 2. Using -lFuzzingEngine is deprecated [1] for various reasons [2]. The old behaviour can be emulated if desired by setting LIB_FUZZING_ENGINE=-lFuzzingEngine . This patch was tested as follows: - Building LO within oss-fuzz via: python infra/helper.py build_fuzzers --sanitizer address libreoffice </path/to/patched-libreoffice-core> python infra/helper.py check_build libreoffice - Building LO fuzzers standalone via: export CC="clang-11" export CXX="clang++-11 -stdlib=libc++" export CFLAGS="-fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" export CXXFLAGS="$CFLAGS -stdlib=libc++" export LDFLAGS="$CFLAGS -Wl,--compress-debug-sections,zlib -lpthread" export LIB_FUZZING_ENGINE=-fsanitize=fuzzer ./autogen.sh --with-distro=LibreOfficeOssFuzz --with-system-libxml make fuzzers (--with-system-libxml only appears to be needed because of issues specific to my build environment/Suse 15.2. I'm invoking clang-11 simply because that's the most modern clang I have installed, plain clang should also work on most sufficiently modern systems). [1] https://github.com/google/oss-fuzz/blob/481280c65048fd12fb2141b9225af511a9ef7ed2/infra/presubmit.py#L46 [2] https://github.com/google/oss-fuzz/issues/2164 Change-Id: Iddb577c30a39620e72372ef6c2d3fda67f8aabdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111691 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac4
1 files changed, 4 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 9e0085370d2b..90b0cf01633b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10396,11 +10396,15 @@ AC_MSG_CHECKING([whether to enable fuzzers])
if test "$enable_fuzzers" != yes; then
AC_MSG_RESULT([no])
else
+ if test $LIB_FUZZING_ENGINE == ""; then
+ AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
+ fi
AC_MSG_RESULT([yes])
ENABLE_FUZZERS="TRUE"
AC_DEFINE([ENABLE_FUZZERS],1)
BUILD_TYPE="$BUILD_TYPE FUZZERS"
fi
+AC_SUBST(LIB_FUZZING_ENGINE)
AC_SUBST(ENABLE_FUZZERS)
dnl ===================================================================