From 341a69ed6fc4fa8f51c09b9cc477223cec4d8e60 Mon Sep 17 00:00:00 2001 From: Jou Ho <43765840+jouho@users.noreply.github.com> Date: Tue, 10 Sep 2024 18:28:25 -0700 Subject: [PATCH] ci: use newer version of libFuzzer (#4762) --- CMakeLists.txt | 11 +++-------- codebuild/spec/buildspec_fuzz.yml | 3 +-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66c2580ae90..c89bae8a817 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,8 +184,8 @@ if(NO_STACK_PROTECTOR) endif() if(S2N_FUZZ_TEST) - target_compile_options(${PROJECT_NAME} PUBLIC -fsanitize-coverage=trace-pc-guard -fsanitize=leak) - target_link_libraries(${PROJECT_NAME} PUBLIC -fsanitize-coverage=trace-pc-guard -fsanitize=leak) + target_compile_options(${PROJECT_NAME} PUBLIC -fsanitize=fuzzer-no-link,leak) + target_link_libraries(${PROJECT_NAME} PUBLIC -fsanitize=fuzzer-no-link,leak) endif() if(TSAN) @@ -602,10 +602,6 @@ if (BUILD_TESTING) target_link_libraries(fuzztest PUBLIC ${PROJECT_NAME}) # Set default values for fuzzing if not defined - if(NOT DEFINED LIBFUZZER_LIB) - message(FATAL_ERROR "LIBFUZZER_LIB is not defined. Please set it to the path of your libFuzzer.a.") - endif() - if(NOT DEFINED FUZZ_TIMEOUT_SEC) set(FUZZ_TIMEOUT_SEC 60) endif() @@ -655,8 +651,7 @@ if (BUILD_TESTING) ) target_link_libraries(${TEST_NAME} PRIVATE fuzztest - ${LIBFUZZER_LIB} # Manually link old libFuzzer.a - -lstdc++ + -fsanitize=fuzzer -lstdc++ ) # Set the output directory for the fuzzing binaries diff --git a/codebuild/spec/buildspec_fuzz.yml b/codebuild/spec/buildspec_fuzz.yml index 40031a6b569..889d64bb5e8 100644 --- a/codebuild/spec/buildspec_fuzz.yml +++ b/codebuild/spec/buildspec_fuzz.yml @@ -61,8 +61,7 @@ phases: - | cmake . -Bbuild \ -DCMAKE_PREFIX_PATH=$LIBCRYPTO_ROOT \ - -DS2N_FUZZ_TEST=on \ - -DLIBFUZZER_LIB=/usr/local/libfuzzer/lib/libFuzzer.a + -DS2N_FUZZ_TEST=on - cmake --build ./build -- -j $(nproc) post_build: on-failure: ABORT