Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multithreaded fuzzer #166

Merged
merged 4 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:

- name: Install deps
run: |
sudo apt-get -y update
DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install python3 apt-transport-https build-essential wget cmake git clang-14 libfuzzer-14-dev
sudo .github/workflows/scripts/llvm.sh 15
DEBIAN_FRONTEND="noninteractive" sudo apt-get -y install python3 apt-transport-https build-essential wget cmake git clang-15 libfuzzer-15-dev

- name: Build
run: ./fuzzing/build.sh
Expand Down
6 changes: 2 additions & 4 deletions fuzzing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ set_target_properties(fuzzer PROPERTIES
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO)


target_include_directories(fuzzer PRIVATE ${libddwaf_SOURCE_DIR}/fuzzing/tools)
target_include_directories(fuzzer PRIVATE ${libddwaf_SOURCE_DIR}/include)
target_include_directories(fuzzer PRIVATE ${libddwaf_SOURCE_DIR}/src)
target_include_directories(fuzzer PRIVATE ${libddwaf_SOURCE_DIR}/src/rule_processor)


set_target_properties(fuzzer PROPERTIES COMPILE_FLAGS "-fsanitize=fuzzer,address,undefined -fprofile-instr-generate -fcoverage-mapping")
set_target_properties(fuzzer PROPERTIES LINK_FLAGS "-fsanitize=fuzzer,address,undefined -fprofile-instr-generate -fcoverage-mapping")
set_target_properties(fuzzer PROPERTIES COMPILE_FLAGS "-fsanitize=fuzzer,address,undefined,leak -fprofile-instr-generate -fcoverage-mapping")
set_target_properties(fuzzer PROPERTIES LINK_FLAGS "-fsanitize=fuzzer,address,undefined,leak -fprofile-instr-generate -fcoverage-mapping")

target_link_libraries(fuzzer
PRIVATE ${LIBDDWAF_PRIVATE_LIBRARIES} ${LIBDDWAF_INTERFACE_LIBRARIES}
Expand Down
4 changes: 2 additions & 2 deletions fuzzing/build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -eu

export CC=clang-14
export CXX=clang++-14
export CC=clang-15
export CXX=clang++-15

rm -rf build && mkdir build && cd build

Expand Down
8 changes: 4 additions & 4 deletions fuzzing/scripts/show_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ set -eu

cd fuzzing

llvm-profdata-14 merge -sparse *.profraw -o default.profdata
llvm-cov-14 show fuzzer -instr-profile=default.profdata -ignore-filename-regex="(fuzzing|third_party)" -format=html > coverage.html
llvm-cov-14 report -instr-profile default.profdata fuzzer -ignore-filename-regex="(fuzzing|third_party)" -show-region-summary=false
llvm-profdata-15 merge -sparse *.profraw -o default.profdata
llvm-cov-15 show fuzzer -instr-profile=default.profdata -ignore-filename-regex="(fuzzing|third_party)" -format=html > coverage.html
llvm-cov-15 report -instr-profile default.profdata fuzzer -ignore-filename-regex="(fuzzing|third_party)" -show-region-summary=false

if [ ! -z ${1:-} ]; then
THRESHOLD=$1
TOTAL=$(llvm-cov-14 report -instr-profile default.profdata fuzzer -ignore-filename-regex="(fuzzing|third_party)" -show-region-summary=false | grep TOTAL)
TOTAL=$(llvm-cov-15 report -instr-profile default.profdata fuzzer -ignore-filename-regex="(fuzzing|third_party)" -show-region-summary=false | grep TOTAL)
ARRAY=($TOTAL)
COVERAGE=$(echo ${ARRAY[3]} | sed -e "s/\.[[:digit:]]*%//g")

Expand Down
136 changes: 0 additions & 136 deletions fuzzing/src/ddwaf_interface.cpp

This file was deleted.

48 changes: 0 additions & 48 deletions fuzzing/src/fuzzer.cpp

This file was deleted.

Loading