Improve libfuzz integration (#2916)

- Allow command line tools to build together with libfuzzer driver.
  Compile everything with `-fsanitize=fuzzer-no-link` to prevent
  linking in libfuzzers's `main` symbol in all executables (causing
  duplicate symbol errors in command line tools), and add
  `-fsanitize=fuzzer` to the libfuzzer driver only.

- Make ASan optional when building with libfuzzer to allow the user
  to choose freely from available sanitizers (e.g., UBSan, MSan,
  HWASan).

- Stabilize libfuzzer by resetting PRNG seed at every invocation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
Akos Kiss
2019-06-19 11:34:06 +02:00
committed by Robert Fancsik
parent 3953fee035
commit 8ee8bc2767
4 changed files with 6 additions and 13 deletions
+1 -11
View File
@@ -64,16 +64,6 @@ if(NOT USING_CLANG)
set(JERRY_LIBFUZZER_MESSAGE " (FORCED BY COMPILER)")
endif()
if(JERRY_LIBFUZZER)
set(JERRY_CMDLINE OFF)
set(JERRY_CMDLINE_TEST OFF)
set(JERRY_CMDLINE_SNAPSHOT OFF)
set(JERRY_CMDLINE_MESSAGE " (FORCED BY LIBFUZZER)")
set(JERRY_CMDLINE_TEST_MESSAGE " (FORCED BY LIBFUZZER)")
set(JERRY_CMDLINE_SNAPSHOT_MESSAGE " (FORCED BY LIBFUZZER)")
endif()
if(JERRY_CMDLINE OR JERRY_CMDLINE_TEST OR JERRY_CMDLINE_SNAPSHOT OR JERRY_LIBFUZZER OR UNITTESTS OR DOCTESTS)
set(JERRY_PORT_DEFAULT ON)
@@ -224,7 +214,7 @@ if(USING_MSVC)
endif()
if(JERRY_LIBFUZZER)
jerry_add_compile_flags(-fsanitize=address,fuzzer)
jerry_add_compile_flags(-fsanitize=fuzzer-no-link)
endif()
# Strip binary