parent
e41b76fe31
commit
3c4ec38d83
@ -45,9 +45,12 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use libafl_frida::{
|
use libafl_frida::{
|
||||||
asan::asan_rt::AsanRuntime, coverage_rt::CoverageRuntime, coverage_rt::MAP_SIZE,
|
coverage_rt::CoverageRuntime, coverage_rt::MAP_SIZE, executor::FridaInProcessExecutor,
|
||||||
executor::FridaInProcessExecutor, helper::FridaInstrumentationHelper, FridaOptions,
|
helper::FridaInstrumentationHelper, FridaOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
use libafl_frida::asan::asan_rt::AsanRuntime;
|
||||||
use libafl_targets::cmplog::{CmpLogObserver, CMPLOG_MAP};
|
use libafl_targets::cmplog::{CmpLogObserver, CMPLOG_MAP};
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
@ -57,11 +57,12 @@ use crate::{
|
|||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(all(feature = "std", unix))]
|
|
||||||
use crate::bolts::os::unix_signals::{Handler, Signal};
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use crate::executors::inprocess::bt_signal_handlers::{
|
use crate::executors::inprocess::bt_signal_handlers::setup_bt_panic_hook;
|
||||||
setup_bt_panic_hook, setup_child_panic_hook,
|
#[cfg(all(feature = "std", unix))]
|
||||||
|
use crate::{
|
||||||
|
bolts::os::unix_signals::{Handler, Signal},
|
||||||
|
executors::inprocess::bt_signal_handlers::setup_child_panic_hook,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The inmem executor simply calls a target function, then returns afterwards.
|
/// The inmem executor simply calls a target function, then returns afterwards.
|
||||||
|
@ -159,13 +159,13 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
impl<'a, 'b, 'c, FH, H, I, OT, S> HasInProcessHandlers
|
impl<'a, 'b, 'c, H, I, OT, RT, S> HasInProcessHandlers
|
||||||
for FridaInProcessExecutor<'a, 'b, 'c, FH, H, I, OT, S>
|
for FridaInProcessExecutor<'a, 'b, 'c, H, I, OT, RT, S>
|
||||||
where
|
where
|
||||||
H: FnMut(&I) -> ExitKind,
|
H: FnMut(&I) -> ExitKind,
|
||||||
I: Input + HasTargetBytes,
|
I: Input + HasTargetBytes,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
FH: FridaHelper<'b>,
|
RT: FridaRuntimeTuple,
|
||||||
{
|
{
|
||||||
/// the timeout handler
|
/// the timeout handler
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -3,15 +3,17 @@ use libafl::{
|
|||||||
inputs::{HasTargetBytes, Input},
|
inputs::{HasTargetBytes, Input},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
use libafl_targets::drcov::DrCovBasicBlock;
|
use libafl_targets::drcov::DrCovBasicBlock;
|
||||||
|
|
||||||
#[cfg(all(feature = "cmplog", target_arch = "aarch64"))]
|
#[cfg(all(feature = "cmplog", target_arch = "aarch64"))]
|
||||||
use crate::cmplog_rt::CmpLogRuntime;
|
use crate::cmplog_rt::CmpLogRuntime;
|
||||||
|
use crate::coverage_rt::CoverageRuntime;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use crate::FridaOptions;
|
use crate::FridaOptions;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use crate::{asan::asan_rt::AsanRuntime, FridaOptions};
|
use crate::{asan::asan_rt::AsanRuntime, drcov_rt::DrCovRuntime, FridaOptions};
|
||||||
use crate::{coverage_rt::CoverageRuntime, drcov_rt::DrCovRuntime};
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
use capstone::{
|
use capstone::{
|
||||||
arch::{self, BuildsCapstone},
|
arch::{self, BuildsCapstone},
|
||||||
@ -130,7 +132,6 @@ impl<RT> Debug for FridaInstrumentationHelper<'_, RT> {
|
|||||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||||
let mut dbg_me = f.debug_struct("FridaInstrumentationHelper");
|
let mut dbg_me = f.debug_struct("FridaInstrumentationHelper");
|
||||||
dbg_me
|
dbg_me
|
||||||
.field("capstone", &self.capstone)
|
|
||||||
.field("ranges", &self.ranges)
|
.field("ranges", &self.ranges)
|
||||||
.field("module_map", &"<ModuleMap>")
|
.field("module_map", &"<ModuleMap>")
|
||||||
.field("options", &self.options);
|
.field("options", &self.options);
|
||||||
@ -247,6 +248,7 @@ where
|
|||||||
let mut first = true;
|
let mut first = true;
|
||||||
for instruction in basic_block {
|
for instruction in basic_block {
|
||||||
let instr = instruction.instr();
|
let instr = instruction.instr();
|
||||||
|
#[cfg(unix)]
|
||||||
let instr_size = instr.bytes().len();
|
let instr_size = instr.bytes().len();
|
||||||
let address = instr.address();
|
let address = instr.address();
|
||||||
//println!("block @ {:x} transformed to {:x}", address, output.writer().pc());
|
//println!("block @ {:x} transformed to {:x}", address, output.writer().pc());
|
||||||
@ -266,6 +268,7 @@ where
|
|||||||
rt.emit_coverage_mapping(address, &output);
|
rt.emit_coverage_mapping(address, &output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
if let Some(rt) = helper.runtime_mut::<DrCovRuntime>() {
|
if let Some(rt) = helper.runtime_mut::<DrCovRuntime>() {
|
||||||
instruction.put_callout(|context| {
|
instruction.put_callout(|context| {
|
||||||
let real_address = rt.real_address_for_stalked(pc(&context));
|
let real_address = rt.real_address_for_stalked(pc(&context));
|
||||||
@ -279,6 +282,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
let res = if let Some(rt) = helper.runtime::<AsanRuntime>() {
|
let res = if let Some(rt) = helper.runtime::<AsanRuntime>() {
|
||||||
rt.asan_is_interesting_instruction(&helper.capstone, address, instr)
|
rt.asan_is_interesting_instruction(&helper.capstone, address, instr)
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,6 +81,7 @@ pub mod drcov_rt;
|
|||||||
pub mod executor;
|
pub mod executor;
|
||||||
|
|
||||||
/// Utilities
|
/// Utilities
|
||||||
|
#[cfg(unix)]
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
// for parsing asan and cmplog cores
|
// for parsing asan and cmplog cores
|
||||||
|
Loading…
x
Reference in New Issue
Block a user