diff --git a/ci/script.sh b/ci/script.sh index 91fad80..03f71c3 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -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 \ @@ -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 \ @@ -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 \ diff --git a/example/src/main.rs b/example/src/main.rs index be7ebe2..cdbf55a 100755 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -3,7 +3,7 @@ use libfuzzer_sys::fuzz_target; fuzz_target!(|data: &[u8]| { - if data == b"banana!" { + if data == "banana!".as_bytes() { panic!("success!"); } }); diff --git a/libfuzzer/FuzzerInterceptors.cpp b/libfuzzer/FuzzerInterceptors.cpp index b877986..d5b0a42 100644 --- a/libfuzzer/FuzzerInterceptors.cpp +++ b/libfuzzer/FuzzerInterceptors.cpp @@ -25,6 +25,7 @@ } #include +#include // for size_t #include #include // for dlsym() diff --git a/libfuzzer/dataflow/DataFlow.cpp b/libfuzzer/dataflow/DataFlow.cpp index 78b3f9a..3af48e2 100644 --- a/libfuzzer/dataflow/DataFlow.cpp +++ b/libfuzzer/dataflow/DataFlow.cpp @@ -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 // @@ -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() {