1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

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
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") set(LINKER_FLAGS "${LINKER_FLAGS} -fsanitize=fuzzer")
endif() 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_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_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}") 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(FuzzTTF)
add_simple_fuzzer(FuzzURL) 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) 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 target_compile_options(FuzzilliJs
PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize-coverage=trace-pc-guard> PRIVATE $<$<C_COMPILER_ID:Clang>:-g -O1 -fsanitize-coverage=trace-pc-guard>
) )

View file

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

View file

@ -1,8 +1,8 @@
diff --git a/Sources/FuzzilliCli/Profiles/Profile.swift b/Sources/FuzzilliCli/Profiles/Profile.swift 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 --- a/Sources/FuzzilliCli/Profiles/Profile.swift
+++ b/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] let additionalBuiltins: [String: Type]
} }
@ -25,6 +25,8 @@ index 6d8a795..a506d41 100644
+ crashTests: ["fuzzilli('FUZZILLI_CRASH', 0)", "fuzzilli('FUZZILLI_CRASH', 1)"], + crashTests: ["fuzzilli('FUZZILLI_CRASH', 0)", "fuzzilli('FUZZILLI_CRASH', 1)"],
+ +
+ additionalCodeGenerators: WeightedList<CodeGenerator>([]), + additionalCodeGenerators: WeightedList<CodeGenerator>([]),
+
+ additionalProgramTemplates: WeightedList<ProgramTemplate>([]),
+ +
+ disabledCodeGenerators: [], + disabledCodeGenerators: [],
+ +
@ -36,7 +38,7 @@ index 6d8a795..a506d41 100644
let profiles = [ let profiles = [
"qjs": qjsProfile, "qjs": qjsProfile,
"jsc": jscProfile, "jsc": jscProfile,
@@ -39,4 +66,5 @@ let profiles = [ @@ -40,4 +69,5 @@ let profiles = [
"v8": v8Profile, "v8": v8Profile,
"duktape": duktapeProfile, "duktape": duktapeProfile,
"jerryscript": jerryscriptProfile, "jerryscript": jerryscriptProfile,