Make ASAN log dumping optional (#2600)

This commit is contained in:
Henry Chu 2024-10-10 15:44:26 +08:00 committed by GitHub
parent efa99ee3c9
commit a69cd98432
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,7 +37,9 @@ use nix::{
}; };
#[cfg(feature = "regex")] #[cfg(feature = "regex")]
use crate::observers::{get_asan_runtime_flags_with_log_path, AsanBacktraceObserver}; use crate::observers::{
get_asan_runtime_flags, get_asan_runtime_flags_with_log_path, AsanBacktraceObserver,
};
use crate::{ use crate::{
executors::{Executor, ExitKind, HasObservers}, executors::{Executor, ExitKind, HasObservers},
inputs::{HasTargetBytes, Input, UsesInput}, inputs::{HasTargetBytes, Input, UsesInput},
@ -309,6 +311,7 @@ impl Forkserver {
memlimit: u64, memlimit: u64,
is_persistent: bool, is_persistent: bool,
is_deferred_frksrv: bool, is_deferred_frksrv: bool,
dump_asan_logs: bool,
coverage_map_size: Option<usize>, coverage_map_size: Option<usize>,
debug_output: bool, debug_output: bool,
) -> Result<Self, Error> { ) -> Result<Self, Error> {
@ -321,6 +324,7 @@ impl Forkserver {
memlimit, memlimit,
is_persistent, is_persistent,
is_deferred_frksrv, is_deferred_frksrv,
dump_asan_logs,
coverage_map_size, coverage_map_size,
debug_output, debug_output,
KILL_SIGNAL_DEFAULT, KILL_SIGNAL_DEFAULT,
@ -340,6 +344,7 @@ impl Forkserver {
memlimit: u64, memlimit: u64,
is_persistent: bool, is_persistent: bool,
is_deferred_frksrv: bool, is_deferred_frksrv: bool,
dump_asan_logs: bool,
coverage_map_size: Option<usize>, coverage_map_size: Option<usize>,
debug_output: bool, debug_output: bool,
kill_signal: Signal, kill_signal: Signal,
@ -385,7 +390,14 @@ impl Forkserver {
} }
#[cfg(feature = "regex")] #[cfg(feature = "regex")]
command.env("ASAN_OPTIONS", get_asan_runtime_flags_with_log_path()); {
let asan_options = if dump_asan_logs {
get_asan_runtime_flags_with_log_path()
} else {
get_asan_runtime_flags()
};
command.env("ASAN_OPTIONS", asan_options);
}
let fsrv_handle = match command let fsrv_handle = match command
.env("LD_BIND_NOW", "1") .env("LD_BIND_NOW", "1")
@ -822,6 +834,7 @@ where
0, 0,
self.is_persistent, self.is_persistent,
self.is_deferred_frksrv, self.is_deferred_frksrv,
self.asan_obs.is_some(),
self.map_size, self.map_size,
self.debug_child, self.debug_child,
self.kill_signal.unwrap_or(KILL_SIGNAL_DEFAULT), self.kill_signal.unwrap_or(KILL_SIGNAL_DEFAULT),