Enabling DrCov on Windows (#1765)

* Enabling DrCov for Windows
This commit is contained in:
mkravchik 2023-12-27 01:10:04 -08:00 committed by GitHub
parent 9ad7d9bb64
commit df96bb02ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,6 @@ use libafl::{
Error,
};
use libafl_bolts::{cli::FuzzerOptions, tuples::MatchFirstType};
#[cfg(unix)]
use libafl_targets::drcov::DrCovBasicBlock;
#[cfg(unix)]
use nix::sys::mman::{mmap, MapFlags, ProtFlags};
@ -29,11 +28,11 @@ use yaxpeax_arm::armv8::a64::{ARMv8, InstDecoder};
#[cfg(target_arch = "x86_64")]
use yaxpeax_x86::amd64::InstDecoder;
#[cfg(unix)]
use crate::asan::asan_rt::AsanRuntime;
#[cfg(all(feature = "cmplog", target_arch = "aarch64"))]
use crate::cmplog_rt::CmpLogRuntime;
use crate::coverage_rt::CoverageRuntime;
#[cfg(unix)]
use crate::{asan::asan_rt::AsanRuntime, drcov_rt::DrCovRuntime};
use crate::{coverage_rt::CoverageRuntime, drcov_rt::DrCovRuntime};
#[cfg(target_vendor = "apple")]
const ANONYMOUS_FLAG: MapFlags = MapFlags::MAP_ANON;
@ -467,7 +466,6 @@ where
let mut basic_block_size = 0;
for instruction in basic_block {
let instr = instruction.instr();
#[cfg(unix)]
let instr_size = instr.bytes().len();
let address = instr.address();
// log::trace!("block @ {:x} transformed to {:x}", address, output.writer().pc());
@ -485,7 +483,6 @@ where
rt.emit_coverage_mapping(address, output);
}
#[cfg(unix)]
if let Some(_rt) = runtimes.match_first_type_mut::<DrCovRuntime>() {
basic_block_start = address;
}
@ -548,14 +545,12 @@ where
);
}
#[cfg(unix)]
if let Some(_rt) = runtimes.match_first_type_mut::<DrCovRuntime>() {
basic_block_size += instr_size;
}
}
instruction.keep();
}
#[cfg(unix)]
if basic_block_size != 0 {
if let Some(rt) = runtimes.borrow_mut().match_first_type_mut::<DrCovRuntime>() {
log::trace!("{basic_block_start:#016X}:{basic_block_size:X}");