Qemu ctrl c exit (#2147)

* fix

* ignore

* fix

* aaa

* bbb
This commit is contained in:
Dongjia "toka" Zhang 2024-05-06 15:42:43 +02:00 committed by GitHub
parent b0d592dc3a
commit 4562f19bdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -88,7 +88,7 @@ impl Handler for ShutdownSignalData {
// println!("Exiting from the handler...."); // println!("Exiting from the handler....");
#[cfg(unix)] #[cfg(unix)]
libc::_exit(100); libc::_exit(CTRL_C_EXIT);
#[cfg(windows)] #[cfg(windows)]
windows::Win32::System::Threading::ExitProcess(100); windows::Win32::System::Threading::ExitProcess(100);

View File

@ -13,7 +13,7 @@ use std::{
ptr, ptr,
}; };
use libafl::executors::ExitKind; use libafl::{events::CTRL_C_EXIT, executors::ExitKind};
#[cfg(emulation_mode = "systemmode")] #[cfg(emulation_mode = "systemmode")]
use libafl_qemu_sys::qemu_init; use libafl_qemu_sys::qemu_init;
#[cfg(emulation_mode = "usermode")] #[cfg(emulation_mode = "usermode")]
@ -287,7 +287,7 @@ where
let (command, ret_reg): (Option<Command>, Option<Regs>) = match &mut exit_reason { let (command, ret_reg): (Option<Command>, Option<Regs>) = match &mut exit_reason {
EmuExitReason::End(shutdown_cause) => match shutdown_cause { EmuExitReason::End(shutdown_cause) => match shutdown_cause {
QemuShutdownCause::HostSignal(Signal::SigInterrupt) => { QemuShutdownCause::HostSignal(Signal::SigInterrupt) => {
return Ok(InnerHandlerResult::Interrupt) std::process::exit(CTRL_C_EXIT);
} }
QemuShutdownCause::GuestPanic => { QemuShutdownCause::GuestPanic => {
return Ok(InnerHandlerResult::EndOfRun(ExitKind::Crash)) return Ok(InnerHandlerResult::EndOfRun(ExitKind::Crash))