Skip to content

Commit 4f5ca8f

Browse files
authored
Fix cmplog for qemu fork executor (#3145)
* update cmplog map ptr * do not lower it; it's still there so it should be working
1 parent 398104c commit 4f5ca8f

File tree

3 files changed

+133
-4
lines changed

3 files changed

+133
-4
lines changed

fuzzers/binary_only/fuzzbench_fork_qemu/Cargo.lock

Lines changed: 128 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fuzzers/binary_only/fuzzbench_fork_qemu/Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ test: build harness
3030

3131
rm -rf out/
3232
timeout 15s {{ FUZZER }} {{ BUILD_DIR }}/harness -- --libafl-in ../../inprocess/libfuzzer_libpng/corpus --libafl-out out ./harness | tee fuzz_stdout.log
33-
if grep -qa "corpus: 2" fuzz_stdout.log; then
33+
if grep -qa "objectives: 1" fuzz_stdout.log; then
3434
echo "Fuzzer is working"
3535
else
3636
echo "Fuzzer does not generate any testcases or any crashes"

fuzzers/binary_only/fuzzbench_fork_qemu/src/fuzzer.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use libafl_qemu::{
5656
Emulator, GuestReg, MmapPerms, QemuExitError, QemuExitReason, QemuForkExecutor,
5757
QemuShutdownCause, Regs,
5858
};
59-
use libafl_targets::EDGES_MAP_DEFAULT_SIZE;
59+
use libafl_targets::{CMPLOG_MAP_PTR, EDGES_MAP_DEFAULT_SIZE};
6060
#[cfg(unix)]
6161
use nix::unistd::dup;
6262

@@ -267,6 +267,9 @@ fn fuzz(
267267
let time_observer = TimeObserver::new("time");
268268

269269
// Create an observation channel using cmplog map
270+
unsafe {
271+
CMPLOG_MAP_PTR = cmplog_map_ptr;
272+
}
270273
let cmplog_observer = unsafe { CmpLogObserver::with_map_ptr("cmplog", cmplog_map_ptr, true) };
271274

272275
let map_feedback = MaxMapFeedback::new(&edges_observer);

0 commit comments

Comments
 (0)