diff --git a/config/src/config.rs b/config/src/config.rs index ac2cef6..2de5022 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -247,6 +247,9 @@ pub struct RuntimeConfig { /* aux_buffer size */ aux_buffer_size: usize, + + /* The path to which nyx logs will be written to from QEMU-Nyx (requires debug mode in QEMU-Nyx) */ + nyx_debug_log_path: Option } impl RuntimeConfig{ @@ -258,6 +261,7 @@ impl RuntimeConfig{ debug_mode: false, worker_id: 0, aux_buffer_size: DEFAULT_AUX_BUFFER_SIZE, + nyx_debug_log_path: None } } @@ -321,6 +325,14 @@ impl RuntimeConfig{ pub fn aux_buffer_size(&self) -> usize { self.aux_buffer_size } + + pub fn set_nyx_debug_log_path(&mut self, path: String) { + self.nyx_debug_log_path = Some(path); + } + + pub fn nyx_debug_log_path(&self) -> Option<&str> { + self.nyx_debug_log_path.as_deref() + } } diff --git a/fuzz_runner/src/nyx/params.rs b/fuzz_runner/src/nyx/params.rs index a580ccf..736253e 100644 --- a/fuzz_runner/src/nyx/params.rs +++ b/fuzz_runner/src/nyx/params.rs @@ -122,6 +122,12 @@ impl QemuParams { cmd.push("-cpu".to_string()); cmd.push("kAFL64-Hypervisor-v1".to_string()); + if let Some(nyx_debug_log_path) = fuzzer_config.runtime.nyx_debug_log_path() { + cmd.push("-D".to_string()); + cmd.push(nyx_debug_log_path.to_string()); + cmd.push("-d".to_string()); + cmd.push("nyx".to_string()); + } if fuzzer_config.runtime.reuse_root_snapshot_path().is_some() { cmd.push("-fast_vm_reload".to_string());