diff --git a/libafl_qemu/src/asan.rs b/libafl_qemu/src/asan.rs index ca53643ce8..4dd2028f6e 100644 --- a/libafl_qemu/src/asan.rs +++ b/libafl_qemu/src/asan.rs @@ -561,7 +561,7 @@ impl QemuAsanHelper { } #[must_use] - pub fn must_instrument(&self, addr: u64) -> bool { + pub fn must_instrument(&self, addr: GuestAddr) -> bool { self.filter.allowed(addr) } @@ -748,7 +748,7 @@ where QT: QemuHelperTuple, { let h = hooks.match_helper_mut::().unwrap(); - if h.must_instrument(pc.into()) { + if h.must_instrument(pc) { Some(pc.into()) } else { None diff --git a/libafl_qemu/src/calls.rs b/libafl_qemu/src/calls.rs index 8e41e257af..8a073e251b 100644 --- a/libafl_qemu/src/calls.rs +++ b/libafl_qemu/src/calls.rs @@ -26,7 +26,7 @@ impl QemuCallTracerHelper { } #[must_use] - pub fn must_instrument(&self, addr: u64) -> bool { + pub fn must_instrument(&self, addr: GuestAddr) -> bool { self.filter.allowed(addr) } @@ -131,7 +131,7 @@ where { let emu = hooks.emulator(); if let Some(h) = hooks.helpers().match_first_type::() { - if !h.must_instrument(pc.into()) { + if !h.must_instrument(pc) { return None; } diff --git a/libafl_qemu/src/cmplog.rs b/libafl_qemu/src/cmplog.rs index 84d6fc8cea..3c771b51d0 100644 --- a/libafl_qemu/src/cmplog.rs +++ b/libafl_qemu/src/cmplog.rs @@ -42,7 +42,7 @@ impl QemuCmpLogHelper { } #[must_use] - pub fn must_instrument(&self, addr: u64) -> bool { + pub fn must_instrument(&self, addr: GuestAddr) -> bool { self.filter.allowed(addr) } } @@ -83,7 +83,7 @@ impl QemuCmpLogChildHelper { } #[must_use] - pub fn must_instrument(&self, addr: u64) -> bool { + pub fn must_instrument(&self, addr: GuestAddr) -> bool { self.filter.allowed(addr) } } @@ -127,7 +127,7 @@ where QT: QemuHelperTuple, { if let Some(h) = hooks.match_helper_mut::() { - if !h.must_instrument(pc.into()) { + if !h.must_instrument(pc) { return None; } } @@ -159,7 +159,7 @@ where QT: QemuHelperTuple, { if let Some(h) = hooks.match_helper_mut::() { - if !h.must_instrument(pc.into()) { + if !h.must_instrument(pc) { return None; } } diff --git a/libafl_qemu/src/drcov.rs b/libafl_qemu/src/drcov.rs index d4b38498b8..1ca55b7a4d 100644 --- a/libafl_qemu/src/drcov.rs +++ b/libafl_qemu/src/drcov.rs @@ -62,7 +62,7 @@ impl QemuDrCovHelper { } #[must_use] - pub fn must_instrument(&self, addr: u64) -> bool { + pub fn must_instrument(&self, addr: GuestAddr) -> bool { self.filter.allowed(addr) } } @@ -178,7 +178,7 @@ where .helpers() .match_first_type::() .unwrap(); - if !drcov_helper.must_instrument(pc.into()) { + if !drcov_helper.must_instrument(pc) { return None; } diff --git a/libafl_qemu/src/edges.rs b/libafl_qemu/src/edges.rs index 1bac924c1a..942fc951e7 100644 --- a/libafl_qemu/src/edges.rs +++ b/libafl_qemu/src/edges.rs @@ -56,7 +56,7 @@ impl QemuEdgeCoverageHelper { } #[must_use] - pub fn must_instrument(&self, addr: u64) -> bool { + pub fn must_instrument(&self, addr: GuestAddr) -> bool { self.filter.allowed(addr) } } @@ -112,7 +112,7 @@ impl QemuEdgeCoverageChildHelper { } #[must_use] - pub fn must_instrument(&self, addr: u64) -> bool { + pub fn must_instrument(&self, addr: GuestAddr) -> bool { self.filter.allowed(addr) } } @@ -162,7 +162,7 @@ where QT: QemuHelperTuple, { if let Some(h) = hooks.helpers().match_first_type::() { - if !h.must_instrument(src.into()) && !h.must_instrument(dest.into()) { + if !h.must_instrument(src) && !h.must_instrument(dest) { return None; } } @@ -224,7 +224,7 @@ where .helpers() .match_first_type::() { - if !h.must_instrument(src.into()) && !h.must_instrument(dest.into()) { + if !h.must_instrument(src) && !h.must_instrument(dest) { return None; } } diff --git a/libafl_qemu/src/helper.rs b/libafl_qemu/src/helper.rs index d579b635d2..bb3f1da344 100644 --- a/libafl_qemu/src/helper.rs +++ b/libafl_qemu/src/helper.rs @@ -2,7 +2,10 @@ use core::{fmt::Debug, ops::Range}; use libafl::{bolts::tuples::MatchFirstType, executors::ExitKind, inputs::UsesInput}; -use crate::{emu::Emulator, hooks::QemuHooks}; +use crate::{ + emu::{Emulator, GuestAddr}, + hooks::QemuHooks, +}; /// A helper for `libafl_qemu`. // TODO remove 'static when specialization will be stable @@ -114,14 +117,14 @@ where #[derive(Debug)] pub enum QemuInstrumentationFilter { - AllowList(Vec>), - DenyList(Vec>), + AllowList(Vec>), + DenyList(Vec>), None, } impl QemuInstrumentationFilter { #[must_use] - pub fn allowed(&self, addr: u64) -> bool { + pub fn allowed(&self, addr: GuestAddr) -> bool { match self { QemuInstrumentationFilter::AllowList(l) => { for rng in l {