diff --git a/libafl/src/executors/forkserver.rs b/libafl/src/executors/forkserver.rs index 7104dbb86d..f3a403827b 100644 --- a/libafl/src/executors/forkserver.rs +++ b/libafl/src/executors/forkserver.rs @@ -891,6 +891,7 @@ where min_input_size: self.min_input_size, max_input_size: self.max_input_size, timeout, + #[cfg(feature = "regex")] asan_obs: self .asan_obs .clone() @@ -956,6 +957,7 @@ where min_input_size: self.min_input_size, max_input_size: self.max_input_size, timeout, + #[cfg(feature = "regex")] asan_obs: self .asan_obs .clone() @@ -1003,7 +1005,7 @@ where 0, self.is_persistent, self.is_deferred_frksrv, - self.asan_obs.is_some(), + self.has_asan_obs(), self.map_size, self.debug_child, self.kill_signal.unwrap_or(KILL_SIGNAL_DEFAULT), @@ -1456,6 +1458,18 @@ where self.kill_signal = Some(kill_signal); self } + + /// Determine if the asan observer is present (always false if feature "regex" is disabled) + #[cfg(feature = "regex")] + pub fn has_asan_obs(&self) -> bool { + self.asan_obs.is_some() + } + + /// Determine if the asan observer is present (always false if feature "regex" is disabled) + #[cfg(not(feature = "regex"))] + pub fn has_asan_obs(&self) -> bool { + false + } } impl<'a> ForkserverExecutorBuilder<'a, NopTargetBytesConverter, UnixShMemProvider> { @@ -1485,6 +1499,7 @@ impl<'a> ForkserverExecutorBuilder<'a, NopTargetBytesConverter, Unix min_input_size: MIN_INPUT_SIZE_DEFAULT, kill_signal: None, timeout: None, + #[cfg(feature = "regex")] asan_obs: None, crash_exitcode: None, target_bytes_converter: NopTargetBytesConverter::new(), @@ -1517,6 +1532,7 @@ impl<'a, TC> ForkserverExecutorBuilder<'a, TC, UnixShMemProvider> { min_input_size: self.min_input_size, kill_signal: self.kill_signal, timeout: self.timeout, + #[cfg(feature = "regex")] asan_obs: self.asan_obs, crash_exitcode: self.crash_exitcode, target_bytes_converter: self.target_bytes_converter, @@ -1549,6 +1565,7 @@ impl<'a, TC, SP> ForkserverExecutorBuilder<'a, TC, SP> { min_input_size: self.min_input_size, kill_signal: self.kill_signal, timeout: self.timeout, + #[cfg(feature = "regex")] asan_obs: self.asan_obs, crash_exitcode: self.crash_exitcode, target_bytes_converter, diff --git a/libafl/src/stages/verify_timeouts.rs b/libafl/src/stages/verify_timeouts.rs index 1fac5afe7e..19749083c0 100644 --- a/libafl/src/stages/verify_timeouts.rs +++ b/libafl/src/stages/verify_timeouts.rs @@ -9,12 +9,10 @@ use std::{cell::RefCell, collections::VecDeque, fmt::Debug, marker::PhantomData, use libafl_bolts::Error; use serde::{de::DeserializeOwned, Deserialize, Serialize}; -#[cfg(not(miri))] -use crate::inputs::BytesInput; use crate::{ corpus::Corpus, executors::{Executor, HasObservers, HasTimeout}, - inputs::UsesInput, + inputs::{BytesInput, UsesInput}, observers::ObserversTuple, stages::Stage, state::{HasCorpus, State, UsesState}, diff --git a/libafl_bolts/src/serdeany.rs b/libafl_bolts/src/serdeany.rs index 9b16e9a548..ccc34a59cc 100644 --- a/libafl_bolts/src/serdeany.rs +++ b/libafl_bolts/src/serdeany.rs @@ -825,6 +825,26 @@ macro_rules! create_register { ($struct_type:ty) => {}; } +/// Manually register a `SerdeAny` type in the [`RegistryBuilder`] +/// +/// Do nothing with the `serdeany_autoreg` feature, as this will be previously registered by ctor. +#[cfg(all(feature = "serdeany_autoreg", not(miri)))] +#[macro_export] +macro_rules! create_manual_register { + ($struct_type:ty) => {}; +} + +/// Manually register a `SerdeAny` type in the [`RegistryBuilder`] +/// +/// Do nothing with the `serdeany_autoreg` feature, as this will be previously registered by ctor. +#[cfg(not(all(feature = "serdeany_autoreg", not(miri))))] +#[macro_export] +macro_rules! create_manual_register { + ($struct_type:ty) => { + $crate::serdeany::RegistryBuilder::register::<$struct_type>(); + }; +} + /// Implement a [`SerdeAny`], registering it in the [`RegistryBuilder`] when on std #[macro_export] macro_rules! impl_serdeany { @@ -853,7 +873,6 @@ macro_rules! impl_serdeany { } } - #[cfg(any(not(feature = "serdeany_autoreg"), miri))] impl< $( $lt $( : $clt $(+ $dlt )* )? ),+ > $struct_name < $( $lt ),+ > { /// Manually register this type at a later point in time @@ -861,7 +880,9 @@ macro_rules! impl_serdeany { /// # Safety /// This may never be called concurrently as it dereferences the `RegistryBuilder` without acquiring a lock. pub unsafe fn register() { - $crate::serdeany::RegistryBuilder::register::<$struct_name < $( $lt ),+ >>(); + $( + $crate::create_manual_register!($struct_name < $( $opt ),+ >); + )* } } @@ -894,7 +915,6 @@ macro_rules! impl_serdeany { } } - #[cfg(any(not(feature = "serdeany_autoreg"), miri))] impl $struct_name { /// Manually register this type at a later point in time /// @@ -902,7 +922,7 @@ macro_rules! impl_serdeany { /// This may never be called concurrently as it dereferences the `RegistryBuilder` without acquiring a lock. #[allow(unused)] pub unsafe fn register() { - $crate::serdeany::RegistryBuilder::register::<$struct_name>(); + $crate::create_manual_register!($struct_name); } } diff --git a/scripts/clippy.ps1 b/scripts/clippy.ps1 index 8ccfb2265f..880cc5f075 100644 --- a/scripts/clippy.ps1 +++ b/scripts/clippy.ps1 @@ -17,20 +17,7 @@ function Run-Clippy { try { $env:RUST_BACKTRACE = "full" - cargo +nightly clippy --all-features --no-deps --tests --examples --benches -- -Z macro-backtrace ` - -D clippy::all ` - -D clippy::pedantic ` - -W clippy::similar_names ` - -A clippy::type_repetition_in_bounds ` - -A clippy::missing-errors-doc ` - -A clippy::cast-possible-truncation ` - -A clippy::used-underscore-binding ` - -A clippy::ptr-as-ptr ` - -A clippy::missing-panics-doc ` - -A clippy::missing-docs-in-private-items ` - -A clippy::unseparated-literal-suffix ` - -A clippy::module-name-repetitions ` - -A clippy::unreadable-literal + cargo +nightly clippy --all-features --no-deps --tests --examples --benches -- -Z macro-backtrace # Exit unsuccessfully on clippy error if (!$?) { @@ -68,20 +55,7 @@ else { # First run it on all default members $env:RUST_BACKTRACE = "full" -cargo +nightly clippy --all-features --no-deps --tests --examples --benches -- -Z macro-backtrace ` - -D clippy::all ` - -D clippy::pedantic ` - -W clippy::similar_names ` - -A clippy::type_repetition_in_bounds ` - -A clippy::missing-errors-doc ` - -A clippy::cast-possible-truncation ` - -A clippy::used-underscore-binding ` - -A clippy::ptr-as-ptr ` - -A clippy::missing-panics-doc ` - -A clippy::missing-docs-in-private-items ` - -A clippy::unseparated-literal-suffix ` - -A clippy::module-name-repetitions ` - -A clippy::unreadable-literal +cargo +nightly clippy --all-features --no-deps --tests --examples --benches -- -Z macro-backtrace # Exit unsuccessfully on clippy error if (!$?) {