mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 02:07:35 +00:00
Meta: Rename Fuzzer flags to ENABLE_FUZZERS_{LIBFUZZER,OSSFUZZ}
This commit is contained in:
parent
7d51696d5d
commit
e3519b8e5c
8 changed files with 19 additions and 17 deletions
|
@ -61,7 +61,7 @@ if [ "$#" -gt "0" ] && [ "--oss-fuzz" = "$1" ] ; then
|
|||
cmake -GNinja -B Build/fuzzers \
|
||||
-DBUILD_LAGOM=ON \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DENABLE_OSS_FUZZ=ON \
|
||||
-DENABLE_FUZZERS_OSSFUZZ=ON \
|
||||
-DCMAKE_C_COMPILER="$CC" \
|
||||
-DCMAKE_CXX_COMPILER="$CXX" \
|
||||
-DCMAKE_CXX_FLAGS="$CXXFLAGS -DOSS_FUZZ=ON" \
|
||||
|
@ -74,7 +74,7 @@ else
|
|||
pick_clang
|
||||
cmake -GNinja -B Build/lagom-fuzzers \
|
||||
-DBUILD_LAGOM=ON \
|
||||
-DENABLE_FUZZER_SANITIZER=ON \
|
||||
-DENABLE_FUZZERS_LIBFUZZER=ON \
|
||||
-DENABLE_ADDRESS_SANITIZER=ON \
|
||||
-DENABLE_UNDEFINED_SANITIZER=ON \
|
||||
-DCMAKE_PREFIX_PATH=Build/tool-install \
|
||||
|
|
|
@ -64,7 +64,7 @@ add_compile_options(-Wall -Wextra -Werror)
|
|||
add_compile_options(-fPIC -g)
|
||||
add_compile_options(-Wno-maybe-uninitialized)
|
||||
add_compile_options(-fno-exceptions)
|
||||
if (NOT ENABLE_FUZZER_SANITIZER)
|
||||
if (NOT ENABLE_FUZZERS_LIBFUZZER)
|
||||
add_compile_options(-fno-semantic-interposition)
|
||||
endif()
|
||||
|
||||
|
@ -109,14 +109,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|||
# Clang's default constexpr-steps limit is 1048576(2^20), GCC doesn't have one
|
||||
add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals -fconstexpr-steps=16777216)
|
||||
|
||||
if (ENABLE_FUZZER_SANITIZER)
|
||||
if (ENABLE_FUZZERS_LIBFUZZER)
|
||||
add_compile_options(-fsanitize=fuzzer -fno-omit-frame-pointer)
|
||||
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=fuzzer")
|
||||
endif()
|
||||
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-Wno-expansion-to-defined)
|
||||
if (ENABLE_FUZZER_SANITIZER)
|
||||
if (ENABLE_FUZZERS_LIBFUZZER)
|
||||
message(FATAL_ERROR
|
||||
"Fuzzer Sanitizer (-fsanitize=fuzzer) is only supported for Fuzzer targets with LLVM. "
|
||||
"Reconfigure CMake with -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER pointing to a clang-based toolchain"
|
||||
|
@ -173,7 +173,7 @@ function(lagom_lib library fs_name)
|
|||
|
||||
# Don't make alias when we're going to import a previous build for Tools
|
||||
# FIXME: Is there a better way to write this?
|
||||
if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER)
|
||||
if (NOT ENABLE_FUZZERS_OSSFUZZ AND NOT ENABLE_FUZZERS_LIBFUZZER)
|
||||
# alias for parity with exports
|
||||
add_library(Lagom::${library} ALIAS ${target_name})
|
||||
endif()
|
||||
|
@ -272,7 +272,7 @@ install(
|
|||
# Code Generators and other host tools
|
||||
# We need to make sure not to build code generators for Fuzzer builds, as they already have their own main.cpp
|
||||
# Instead, we import them from a previous install of Lagom. This mandates a two-stage build for fuzzers.
|
||||
if (ENABLE_OSS_FUZZ OR ENABLE_FUZZER_SANITIZER)
|
||||
if (ENABLE_FUZZERS_OSSFUZZ OR ENABLE_FUZZERS_LIBFUZZER)
|
||||
find_package(Lagom REQUIRED)
|
||||
else()
|
||||
add_subdirectory(Tools)
|
||||
|
@ -483,7 +483,7 @@ if (BUILD_LAGOM)
|
|||
lagom_lib(XML xml
|
||||
SOURCES ${LIBXML_SOURCES})
|
||||
|
||||
if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER AND NOT ENABLE_COMPILER_EXPLORER_BUILD)
|
||||
if (NOT ENABLE_FUZZERS_OSSFUZZ AND NOT ENABLE_FUZZERS_LIBFUZZER AND NOT ENABLE_COMPILER_EXPLORER_BUILD)
|
||||
# Lagom Examples
|
||||
add_executable(TestApp TestApp.cpp)
|
||||
target_link_libraries(TestApp LagomCore)
|
||||
|
@ -711,6 +711,6 @@ if (BUILD_LAGOM)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_FUZZER_SANITIZER OR ENABLE_OSS_FUZZ)
|
||||
if (ENABLE_FUZZERS_LIBFUZZER OR ENABLE_FUZZERS_OSSFUZZ)
|
||||
add_subdirectory(Fuzzers)
|
||||
endif()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function(add_simple_fuzzer name)
|
||||
add_executable(${name} "${name}.cpp")
|
||||
|
||||
if (ENABLE_OSS_FUZZ)
|
||||
if (ENABLE_FUZZERS_OSSFUZZ)
|
||||
target_link_libraries(${name}
|
||||
PUBLIC ${ARGN} LagomCore)
|
||||
else()
|
||||
|
@ -63,7 +63,7 @@ add_simple_fuzzer(FuzzWasmParser LagomWasm)
|
|||
add_simple_fuzzer(FuzzZip LagomArchive)
|
||||
add_simple_fuzzer(FuzzZlibDecompression LagomCompress)
|
||||
|
||||
if (NOT ENABLE_OSS_FUZZ)
|
||||
if (NOT ENABLE_FUZZERS_OSSFUZZ)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${ORIGINAL_CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${ORIGINAL_CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${ORIGINAL_CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
|
||||
|
|
|
@ -39,7 +39,7 @@ RUN sed -i 's/-Wmissing-declarations //' ../CMakeLists.txt
|
|||
RUN CXXFLAGS="-Wno-defaulted-function-deleted" \
|
||||
cmake -GNinja \
|
||||
-DBUILD_LAGOM=ON \
|
||||
-DENABLE_FUZZER_SANITIZER=ON \
|
||||
-DENABLE_FUZZERS_LIBFUZZER=ON \
|
||||
-DCMAKE_C_COMPILER=clang \
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
..
|
||||
|
|
|
@ -27,7 +27,7 @@ the ``BuildFuzzers.sh`` script with no arguments. The script does the equivalent
|
|||
# Stage 2: Build fuzzers, making sure the build can find the tools we just built
|
||||
cmake -GNinja -B Build/lagom-fuzzers \
|
||||
-DBUILD_LAGOM=ON \
|
||||
-DENABLE_FUZZER_SANITIZER=ON \
|
||||
-DENABLE_FUZZERS_LIBFUZZER=ON \
|
||||
-DENABLE_ADDRESS_SANITIZER=ON \
|
||||
-DENABLE_UNDEFINED_SANITIZER=ON \
|
||||
-DCMAKE_PREFIX_PATH=Build/tool-install \
|
||||
|
@ -72,7 +72,7 @@ Feel free to upload lots and lots files there, or use them for great good!
|
|||
|
||||
### Fuzzing on OSS-Fuzz
|
||||
|
||||
https://oss-fuzz.com/ automatically runs all fuzzers in the Fuzzers/ subdirectory whose name starts with "Fuzz" and which are added to the build in `Fuzzers/CMakeLists.txt` if `ENABLE_OSS_FUZZ` is set. Looking for "serenity" on oss-fuzz.com finds interesting links, in particular:
|
||||
https://oss-fuzz.com/ automatically runs all fuzzers in the Fuzzers/ subdirectory whose name starts with "Fuzz" and which are added to the build in `Fuzzers/CMakeLists.txt` if `ENABLE_FUZZERS_OSSFUZZ` is set. Looking for "serenity" on oss-fuzz.com finds interesting links, in particular:
|
||||
|
||||
* [known open bugs found by fuzzers](https://oss-fuzz.com/testcases?project=serenity&open=yes)
|
||||
* [oss-fuzz bug tracker for these](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:serenity)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue