MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / analyze_crashes

Function analyze_crashes

hail-fuzz/src/debugging/replay.rs:267–305  ·  view source on GitHub ↗
(mut config: Config, path: &str)

Source from the content-addressed store, hash-verified

265}
266
267pub fn analyze_crashes(mut config: Config, path: &str) -> anyhow::Result<()> {
268 let features = config::EnabledFeatures::from_env()?;
269 let (mut target, mut vm) = setup_vm(&mut config, &features)?;
270 target.initialize_vm(&config.fuzzer, &mut vm)?;
271
272 let path_tracer = trace::add_path_tracer(&mut vm, target.mmio_handler.unwrap())?;
273 let xpsr_reg = vm.cpu.arch.sleigh.get_varnode("xpsr").unwrap();
274
275 let input_src = InputSource::from_str(path);
276
277 let snapshot = vm.snapshot();
278 for entry in input_src.list_files().with_context(|| format!("failed list files in: {path}"))? {
279 vm.restore(&snapshot);
280 path_tracer.clear(&mut vm);
281
282 let input = MultiStream::from_bytes(&input_src.read_child(&entry)?)
283 .with_context(|| format!("Invalid file format: {}", entry.display()))?;
284 target.get_mmio_handler(&mut vm).unwrap().clone_from(&input);
285
286 eprintln!("-------------------\n{}", entry.display());
287 let exit = target.run(&mut vm)?;
288 let active_irq = vm.cpu.read_reg(xpsr_reg) & 0x1ff;
289 eprintln!(
290 "\n[icicle] exited with: {} (icount = {}), active_irq = {active_irq}",
291 target.exit_string(exit),
292 vm.cpu.icount()
293 );
294
295 if !matches!(exit, VmExit::UnhandledException((ExceptionCode::Environment, _))) {
296 // Print additional information for unknown crashes.
297 eprintln!("[icicle] callstack:\n{}", icicle_vm::debug::backtrace(&mut vm));
298 eprintln!("[icicle] last blocks:\n{}", path_tracer.print_last_blocks(&mut vm, 10));
299 }
300
301 eprintln!("-------------------\n");
302 }
303
304 Ok(())
305}
306
307#[derive(Debug, Clone, Copy)]
308enum Compression {

Callers 1

runFunction · 0.85

Calls 11

setup_vmFunction · 0.85
add_path_tracerFunction · 0.85
initialize_vmMethod · 0.80
list_filesMethod · 0.80
read_childMethod · 0.80
clone_fromMethod · 0.80
get_mmio_handlerMethod · 0.80
snapshotMethod · 0.45
restoreMethod · 0.45
clearMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected