Skip to content

Commit

Permalink
Merge pull request #89 from fitzgen/update-libfuzzer-60e32a1
Browse files Browse the repository at this point in the history
Update libFuzzer to llvm/llvm-project@60e32a1
  • Loading branch information
fitzgen authored Mar 3, 2022
2 parents fcf3b18 + 1aa53e0 commit 76f10a7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
9 changes: 6 additions & 3 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ pushd ./example
cargo rustc \
--release \
-- \
-Cpasses='sancov' \
-Ccodegen-units=1 \
-Cpasses=sancov-module \
-Cllvm-args=-sanitizer-coverage-level=3 \
-Cllvm-args=-sanitizer-coverage-trace-compares \
-Cllvm-args=-sanitizer-coverage-inline-8bit-counters \
Expand All @@ -26,7 +27,8 @@ pushd ./example_arbitrary
cargo rustc \
--release \
-- \
-Cpasses='sancov' \
-Ccodegen-units=1 \
-Cpasses=sancov-module \
-Cllvm-args=-sanitizer-coverage-level=3 \
-Cllvm-args=-sanitizer-coverage-trace-compares \
-Cllvm-args=-sanitizer-coverage-inline-8bit-counters \
Expand All @@ -46,7 +48,8 @@ pushd ./example_mutator
cargo rustc \
--release \
-- \
-Cpasses='sancov' \
-Ccodegen-units=1 \
-Cpasses=sancov-module \
-Cllvm-args=-sanitizer-coverage-level=3 \
-Cllvm-args=-sanitizer-coverage-trace-compares \
-Cllvm-args=-sanitizer-coverage-inline-8bit-counters \
Expand Down
2 changes: 1 addition & 1 deletion example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
if data == b"banana!" {
if data == "banana!".as_bytes() {
panic!("success!");
}
});
1 change: 1 addition & 0 deletions libfuzzer/FuzzerInterceptors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
}

#include <cassert>
#include <cstddef> // for size_t
#include <cstdint>
#include <dlfcn.h> // for dlsym()

Expand Down
6 changes: 2 additions & 4 deletions libfuzzer/dataflow/DataFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
// and also provides basic-block coverage for every input.
//
// Build:
// 1. Compile this file (DataFlow.cpp) with -fsanitize=dataflow -mllvm
// -dfsan-fast-16-labels and -O2.
// 1. Compile this file (DataFlow.cpp) with -fsanitize=dataflow and -O2.
// 2. Compile DataFlowCallbacks.cpp with -O2 -fPIC.
// 3. Build the fuzz target with -g -fsanitize=dataflow
// -mllvm -dfsan-fast-16-labels
// -fsanitize-coverage=trace-pc-guard,pc-table,bb,trace-cmp
// 4. Link those together with -fsanitize=dataflow
//
Expand Down Expand Up @@ -82,7 +80,7 @@ static inline bool BlockIsEntry(size_t BlockIdx) {
return __dft.PCsBeg[BlockIdx * 2 + 1] & PCFLAG_FUNC_ENTRY;
}

const int kNumLabels = 16;
const int kNumLabels = 8;

// Prints all instrumented functions.
static int PrintFunctions() {
Expand Down

0 comments on commit 76f10a7

Please sign in to comment.