fix wrong minia

This commit is contained in:
Alwin Berger 2025-02-26 10:52:59 +01:00
parent 56c046ecf6
commit fd336e8ab0
3 changed files with 20 additions and 2 deletions

View File

@ -68,7 +68,7 @@ pub fn get_all_fn_symbol_ranges(elf: &EasyElf, range: std::ops::Range<GuestAddr>
#[allow(unused)] #[allow(unused)]
extern "C" { extern "C" {
static mut libafl_interrupt_offsets : [[u32; MAX_NUM_INTERRUPT]; NUM_INTERRUPT_SOURCES]; static mut libafl_interrupt_offsets : [[u32; MAX_NUM_INTERRUPT]; NUM_INTERRUPT_SOURCES];
static mut libafl_num_interrupts : [usize; NUM_INTERRUPT_SOURCES]; static mut libafl_num_interrupts : [u64; NUM_INTERRUPT_SOURCES];
} }
@ -288,7 +288,7 @@ let run_client = |state: Option<_>, mut mgr, _core_id| {
let input_bytes = input.parts_by_name(&name).next().map(|x| x.1.bytes()).unwrap_or(&[]); let input_bytes = input.parts_by_name(&name).next().map(|x| x.1.bytes()).unwrap_or(&[]);
let t = input_bytes_to_interrupt_times(input_bytes, c); let t = input_bytes_to_interrupt_times(input_bytes, c);
for j in 0..t.len() {libafl_interrupt_offsets[i][j]=t[j];} for j in 0..t.len() {libafl_interrupt_offsets[i][j]=t[j];}
libafl_num_interrupts[i]=t.len(); libafl_num_interrupts[i]=t.len() as u64;
} }
// println!("Load: {:?}", libafl_interrupt_offsets[0..libafl_num_interrupts].to_vec()); // println!("Load: {:?}", libafl_interrupt_offsets[0..libafl_num_interrupts].to_vec());

View File

@ -204,6 +204,10 @@ impl AtomicBasicBlock {
pub fn instance_eq(&self, other: &Self) -> bool { pub fn instance_eq(&self, other: &Self) -> bool {
self == other && self.instance_id == other.instance_id self == other && self.instance_id == other.instance_id
} }
pub fn get_start(&self) -> GuestAddr {
self.start
}
} }

View File

@ -287,6 +287,20 @@ where {
writeln!(file, "{},{}", i.0, i.1).expect("Write to dump failed"); writeln!(file, "{},{}", i.0, i.1).expect("Write to dump failed");
} }
} }
// write out the worst case trace
if hist.1 == (icount, timestamp) {
let tracename = td.with_extension("icounttrace.ron");
let trace = state
.metadata::<SYS::TraceData>()
.expect("TraceData not found");
std::fs::write(
tracename,
ron::to_string(trace)
.expect("Error serializing hashmap"),
)
.expect("Can not dump to file");
}
} }
Ok(false) Ok(false)
} }