fast snapshots by default
This commit is contained in:
parent
5fad373199
commit
3a7c0da037
@ -5,7 +5,7 @@ authors = ["Alwin Berger <alwin.berger@tu-dortmund.de>"]
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "snapshot_restore", "singlecore", "restarting", "do_hash_notify_state", "config_stg", "fuzz_int" ]
|
default = ["std", "snapshot_restore", "snapshot_fast", "singlecore", "restarting", "do_hash_notify_state", "config_stg", "fuzz_int" ]
|
||||||
std = []
|
std = []
|
||||||
# Exec environemnt basics
|
# Exec environemnt basics
|
||||||
snapshot_restore = []
|
snapshot_restore = []
|
||||||
|
@ -423,20 +423,27 @@ let mut run_client = |state: Option<_>, mut mgr, _core_id| {
|
|||||||
// "-semihosting",
|
// "-semihosting",
|
||||||
// "--semihosting-config",
|
// "--semihosting-config",
|
||||||
// "enable=on,target=native",
|
// "enable=on,target=native",
|
||||||
// "-snapshot",
|
#[cfg(not(feature = "snapshot_fast"))]
|
||||||
// "-drive",
|
"-snapshot",
|
||||||
// "if=none,format=qcow2,file=dummy.qcow2",
|
#[cfg(not(feature = "snapshot_fast"))]
|
||||||
|
"-drive",
|
||||||
|
#[cfg(not(feature = "snapshot_fast"))]
|
||||||
|
"if=none,format=qcow2,file=dummy.qcow2",
|
||||||
].into_iter().map(String::from).collect();
|
].into_iter().map(String::from).collect();
|
||||||
let env: Vec<(String, String)> = env::vars().collect();
|
let env: Vec<(String, String)> = env::vars().collect();
|
||||||
let emu = Qemu::init(&args, &env).expect("Emulator creation failed");
|
let emu = Qemu::init(&args, &env).expect("Emulator creation failed");
|
||||||
|
|
||||||
// if let Some(main_addr) = main_addr {
|
if let Some(main_addr) = main_addr {
|
||||||
// unsafe {
|
unsafe {
|
||||||
// emu.set_breakpoint(main_addr);
|
libafl_qemu::sys::libafl_qemu_set_native_breakpoint(main_addr as u64);
|
||||||
// emu.run();
|
emu.run();
|
||||||
// emu.remove_breakpoint(main_addr);
|
libafl_qemu::sys::libafl_qemu_remove_native_breakpoint(main_addr as u64);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
#[cfg(feature = "snapshot_fast")]
|
||||||
|
let initial_snap = Some(emu.create_fast_snapshot(true));
|
||||||
|
#[cfg(not(feature = "snapshot_fast"))]
|
||||||
|
let initial_snap = None;
|
||||||
|
|
||||||
unsafe { emu.set_breakpoint(breakpoint); }// BREAKPOINT
|
unsafe { emu.set_breakpoint(breakpoint); }// BREAKPOINT
|
||||||
|
|
||||||
@ -590,7 +597,7 @@ let mut run_client = |state: Option<_>, mut mgr, _core_id| {
|
|||||||
let qhelpers = (QemuSystemStateHelper::new(api_addreses,api_ranges,isr_addreses,isr_ranges,curr_tcb_pointer,task_queue_addr,task_delay_addr,task_delay_overflow_addr,scheduler_lock,scheduler_running, critical_section,input_counter_ptr,app_range.clone()), qhelpers);
|
let qhelpers = (QemuSystemStateHelper::new(api_addreses,api_ranges,isr_addreses,isr_ranges,curr_tcb_pointer,task_queue_addr,task_delay_addr,task_delay_overflow_addr,scheduler_lock,scheduler_running, critical_section,input_counter_ptr,app_range.clone()), qhelpers);
|
||||||
#[cfg(feature = "observe_edges")]
|
#[cfg(feature = "observe_edges")]
|
||||||
let qhelpers = (QemuEdgeCoverageHelper::new(denylist, QemuFilterList::None), qhelpers);
|
let qhelpers = (QemuEdgeCoverageHelper::new(denylist, QemuFilterList::None), qhelpers);
|
||||||
let qhelpers = (QemuStateRestoreHelper::new(), qhelpers);
|
let qhelpers = (QemuStateRestoreHelper::with_fast(initial_snap), qhelpers);
|
||||||
|
|
||||||
let mut hooks = QemuHooks::new(emu.clone(),qhelpers);
|
let mut hooks = QemuHooks::new(emu.clone(),qhelpers);
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ use libafl_qemu::{
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct QemuStateRestoreHelper {
|
pub struct QemuStateRestoreHelper {
|
||||||
has_snapshot: bool,
|
has_snapshot: bool,
|
||||||
use_snapshot: bool,
|
|
||||||
saved_cpu_states: Vec<CPUArchState>,
|
saved_cpu_states: Vec<CPUArchState>,
|
||||||
fastsnap: Option<FastSnapshotPtr>
|
fastsnap: Option<FastSnapshotPtr>
|
||||||
}
|
}
|
||||||
@ -26,11 +25,15 @@ impl QemuStateRestoreHelper {
|
|||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
has_snapshot: false,
|
has_snapshot: false,
|
||||||
use_snapshot: true,
|
|
||||||
saved_cpu_states: vec![],
|
saved_cpu_states: vec![],
|
||||||
fastsnap: None
|
fastsnap: None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn with_fast(fastsnap: Option<FastSnapshotPtr>) -> Self {
|
||||||
|
let mut r = Self::new();
|
||||||
|
r.fastsnap = fastsnap;
|
||||||
|
r
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for QemuStateRestoreHelper {
|
impl Default for QemuStateRestoreHelper {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user