diff --git a/config/src/config.rs b/config/src/config.rs index 2de5022..0eb9a42 100644 --- a/config/src/config.rs +++ b/config/src/config.rs @@ -249,7 +249,10 @@ pub struct RuntimeConfig { 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 + nyx_debug_log_path: Option, + + /* Whether pt tracing will be enabled. */ + pt_enabled: bool, } impl RuntimeConfig{ @@ -261,7 +264,8 @@ impl RuntimeConfig{ debug_mode: false, worker_id: 0, aux_buffer_size: DEFAULT_AUX_BUFFER_SIZE, - nyx_debug_log_path: None + nyx_debug_log_path: None, + pt_enabled: true, } } @@ -333,7 +337,14 @@ impl RuntimeConfig{ pub fn nyx_debug_log_path(&self) -> Option<&str> { self.nyx_debug_log_path.as_deref() } - + + pub fn set_pt_enabled(&mut self, enabled: bool) { + self.pt_enabled = enabled; + } + + pub fn pt_enabled(&self) -> bool { + self.pt_enabled + } } #[derive(Clone, Debug)] diff --git a/fuzz_runner/src/nyx/params.rs b/fuzz_runner/src/nyx/params.rs index f0cb0be..699ef10 100644 --- a/fuzz_runner/src/nyx/params.rs +++ b/fuzz_runner/src/nyx/params.rs @@ -108,6 +108,7 @@ impl QemuParams { fuzzer_config.runtime.aux_buffer_size() ); nyx_ops += &format!(",dump_pt_trace={}", true); + nyx_ops += &format!(",global_pt_enable={}", fuzzer_config.runtime.pt_enabled()); let mut i = 0; for filter in fuzzer_config.fuzz.ipt_filters { diff --git a/libnyx/src/lib.rs b/libnyx/src/lib.rs index fe60d13..71cfaa1 100644 --- a/libnyx/src/lib.rs +++ b/libnyx/src/lib.rs @@ -99,7 +99,8 @@ impl NyxConfig { println!(" - input_buffer_size -> {}", self.input_buffer_size()); println!(" - input_buffer_write_protection -> {}", self.input_buffer_write_protection()); println!(" - hprintf_fd -> {}", self.hprintf_fd()); - println!(" - process_role: -> {:?}", self.process_role()); + println!(" - process_role: -> {:?}", self.process_role()); + println!(" - pt_enabled: -> {}", self.pt_enabled()); } @@ -249,6 +250,14 @@ impl NyxConfig { self.config.runtime.nyx_debug_log_path() } + pub fn set_pt_enabled(&mut self, enabled: bool) { + self.config.runtime.set_pt_enabled(enabled); + } + + pub fn pt_enabled(&self) -> bool { + self.config.runtime.pt_enabled() + } + pub fn dict(&self) -> Vec> { self.config.fuzz.dict.clone() }