Lagom/Fuzzers: Fix FuzzilliJs build and update patch for new Fuzzilli version

-fsanitize=fuzzer was being added to LINKER_FLAGS from Lagom/CMakeLists,
which we don't want with FuzzilliJs as we want to define the functions
it provides ourselves.
This commit is contained in:
Luke 2021-01-23 19:41:44 +00:00 committed by Andreas Kling
parent f37d3f25e6
commit 1c18d1380f
Notes: sideshowbarker 2024-07-18 22:54:31 +09:00
4 changed files with 16 additions and 6 deletions

View file

@ -31,6 +31,10 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=fuzzer")
endif()
set(ORIGINAL_CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
set(ORIGINAL_CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(ORIGINAL_CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${LINKER_FLAGS}")

View file

@ -34,10 +34,11 @@ add_simple_fuzzer(FuzzShell)
add_simple_fuzzer(FuzzTTF)
add_simple_fuzzer(FuzzURL)
if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER)
if (NOT ENABLE_OSS_FUZZ)
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")
add_executable(FuzzilliJs FuzzilliJs.cpp)
# FIXME: For some reason, these option overrides are ignored and FuzzilliJs gets treated
# as a regular fuzzer. Once fixed, please remove the "AND NOT ENABLE_FUZZER_SANITIZER" above.
target_compile_options(FuzzilliJs
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize-coverage=trace-pc-guard>
)

View file

@ -40,7 +40,10 @@
#include <string>
#include <sys/mman.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
//
// BEGIN FUZZING CODE

View file

@ -1,8 +1,8 @@
diff --git a/Sources/FuzzilliCli/Profiles/Profile.swift b/Sources/FuzzilliCli/Profiles/Profile.swift
index 6d8a795..a506d41 100644
index 900b4e2..c916e84 100644
--- a/Sources/FuzzilliCli/Profiles/Profile.swift
+++ b/Sources/FuzzilliCli/Profiles/Profile.swift
@@ -32,6 +32,33 @@ struct Profile {
@@ -33,6 +33,35 @@ struct Profile {
let additionalBuiltins: [String: Type]
}
@ -26,6 +26,8 @@ index 6d8a795..a506d41 100644
+
+ additionalCodeGenerators: WeightedList<CodeGenerator>([]),
+
+ additionalProgramTemplates: WeightedList<ProgramTemplate>([]),
+
+ disabledCodeGenerators: [],
+
+ additionalBuiltins: [
@ -36,7 +38,7 @@ index 6d8a795..a506d41 100644
let profiles = [
"qjs": qjsProfile,
"jsc": jscProfile,
@@ -39,4 +66,5 @@ let profiles = [
@@ -40,4 +69,5 @@ let profiles = [
"v8": v8Profile,
"duktape": duktapeProfile,
"jerryscript": jerryscriptProfile,