From 36bae9e6491f84d1c7ff726f6300f24f2b6626f4 Mon Sep 17 00:00:00 2001 From: bmc-msft <41130664+bmc-msft@users.noreply.github.com> Date: Wed, 28 Oct 2020 16:43:00 -0400 Subject: [PATCH] disable sympath unless it's set via target_env (#222) --- .../onefuzz-agent/src/tasks/coverage/recorder.rs | 7 +++++-- .../script/win64/libfuzzer-coverage/DumpCounters.js | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/agent/onefuzz-agent/src/tasks/coverage/recorder.rs b/src/agent/onefuzz-agent/src/tasks/coverage/recorder.rs index 7db73a1b73..1556e25e14 100644 --- a/src/agent/onefuzz-agent/src/tasks/coverage/recorder.rs +++ b/src/agent/onefuzz-agent/src/tasks/coverage/recorder.rs @@ -128,10 +128,13 @@ impl CoverageRecorder { .join("libfuzzer-coverage") .join("DumpCounters.js"); + let should_disable_sympath = !self.config.target_env.contains_key("_NT_SYMBOL_PATH"); + let cdb_cmd = format!( - ".scriptload {}; !dumpcounters {:?}; q", + ".scriptload {}; !dumpcounters {:?}, {}; q", script_path.to_string_lossy(), - output.to_string_lossy() + output.to_string_lossy(), + should_disable_sympath, ); let mut cmd = Command::new("cdb.exe"); diff --git a/src/agent/script/win64/libfuzzer-coverage/DumpCounters.js b/src/agent/script/win64/libfuzzer-coverage/DumpCounters.js index 05c40bc203..bf7a5e2263 100644 --- a/src/agent/script/win64/libfuzzer-coverage/DumpCounters.js +++ b/src/agent/script/win64/libfuzzer-coverage/DumpCounters.js @@ -83,7 +83,14 @@ function processModule(module, results_dir) { return true; } -function dumpCounters(results_dir, sample_name) { +function dumpCounters(results_dir, should_disable_sympath) { + if (should_disable_sympath == true) { + logln(`disabling sympath`); + execute('.sympath ""'); + } else { + logln(`not disabling sympath`); + } + // Reset to initial break in `ntdll!LdrpDoDebuggerBreak`. execute(".restart"); @@ -95,7 +102,7 @@ function dumpCounters(results_dir, sample_name) { let found = false; host.currentProcess.Modules.All(function (module) { - let result = processModule(module, results_dir, sample_name); + let result = processModule(module, results_dir); if (result) { found = true; }