Add build plumbing for libFuzzer+ASan fuzz build, addresses #283
- CMakeLists MCRF_FUZZER option (clang-only, -fsanitize=fuzzer-no-link) - Makefile fuzz-build/fuzz/fuzz-long/fuzz-repro/clean-fuzz targets - CommandLineParser -- passthrough after --exec for forwarding libFuzzer argv - McRFPy_API: forward script_args to sys.argv in --exec mode so atheris.Setup() sees libFuzzer flags; set sys.argv[0] to the exec script path to match Python script-mode conventions - .gitignore build-fuzz/ and corpora/crashes dirs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
6bf5c451a3
commit
136d2a2a25
5 changed files with 93 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ option(MCRF_SANITIZE_THREAD "Build with ThreadSanitizer" OFF)
|
|||
option(MCRF_DEBUG_PYTHON "Link against debug CPython from __lib_debug/" OFF)
|
||||
option(MCRF_FREE_THREADED_PYTHON "Link against free-threaded CPython (python3.14t)" OFF)
|
||||
option(MCRF_WASM_DEBUG "Build WASM with DWARF debug info and source maps" OFF)
|
||||
option(MCRF_FUZZER "Build with libFuzzer coverage instrumentation for atheris" OFF)
|
||||
|
||||
# Validate mutually exclusive sanitizers
|
||||
if(MCRF_SANITIZE_ADDRESS AND MCRF_SANITIZE_THREAD)
|
||||
|
|
@ -333,6 +334,15 @@ if(MCRF_SANITIZE_THREAD)
|
|||
-fsanitize=thread)
|
||||
endif()
|
||||
|
||||
if(MCRF_FUZZER)
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
message(FATAL_ERROR "MCRF_FUZZER=ON requires Clang. Invoke with CC=clang-18 CXX=clang++-18.")
|
||||
endif()
|
||||
message(STATUS "libFuzzer coverage instrumentation enabled (atheris harness)")
|
||||
target_compile_options(mcrogueface PRIVATE -fsanitize=fuzzer-no-link)
|
||||
target_link_options(mcrogueface PRIVATE -fsanitize=fuzzer-no-link)
|
||||
endif()
|
||||
|
||||
# Enable Py_DEBUG when linking against debug CPython (matches pydebug ABI)
|
||||
if(MCRF_DEBUG_PYTHON OR MCRF_FREE_THREADED_PYTHON)
|
||||
target_compile_definitions(mcrogueface PRIVATE Py_DEBUG)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue