This reverts commit 620835a73f4a1163177d2b11b61625177c737cd5.
This commit is contained in:
parent
620835a73f
commit
a7bb5196ea
@ -495,6 +495,9 @@ where
|
|||||||
monitor: MT,
|
monitor: MT,
|
||||||
/// The configuration
|
/// The configuration
|
||||||
configuration: EventConfig,
|
configuration: EventConfig,
|
||||||
|
/// Consider this testcase as interesting always if true
|
||||||
|
#[builder(default = false)]
|
||||||
|
always_interesting: bool,
|
||||||
/// The 'main' function to run for each client forked. This probably shouldn't return
|
/// The 'main' function to run for each client forked. This probably shouldn't return
|
||||||
#[builder(default, setter(strip_option))]
|
#[builder(default, setter(strip_option))]
|
||||||
run_client: Option<CF>,
|
run_client: Option<CF>,
|
||||||
@ -684,6 +687,7 @@ where
|
|||||||
|
|
||||||
// Fuzzer client. keeps retrying the connection to broker till the broker starts
|
// Fuzzer client. keeps retrying the connection to broker till the broker starts
|
||||||
let builder = RestartingMgr::<(), MT, S, SP>::builder()
|
let builder = RestartingMgr::<(), MT, S, SP>::builder()
|
||||||
|
.always_interesting(self.always_interesting)
|
||||||
.shmem_provider(self.shmem_provider.clone())
|
.shmem_provider(self.shmem_provider.clone())
|
||||||
.broker_port(self.broker_port)
|
.broker_port(self.broker_port)
|
||||||
.kind(ManagerKind::Client {
|
.kind(ManagerKind::Client {
|
||||||
|
@ -43,7 +43,7 @@ use crate::{
|
|||||||
ProgressReporter,
|
ProgressReporter,
|
||||||
},
|
},
|
||||||
executors::{Executor, HasObservers},
|
executors::{Executor, HasObservers},
|
||||||
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
fuzzer::{Evaluator, EvaluatorObservers, ExecutionProcessor},
|
||||||
inputs::{NopInput, UsesInput},
|
inputs::{NopInput, UsesInput},
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasExecutions, HasLastReportTime, NopState, State, UsesState},
|
state::{HasExecutions, HasLastReportTime, NopState, State, UsesState},
|
||||||
@ -59,6 +59,8 @@ where
|
|||||||
{
|
{
|
||||||
/// We only send 1 testcase for every `throttle` second
|
/// We only send 1 testcase for every `throttle` second
|
||||||
pub(crate) throttle: Option<Duration>,
|
pub(crate) throttle: Option<Duration>,
|
||||||
|
/// Treat the incoming testcase as interesting always without evaluating them
|
||||||
|
always_interesting: bool,
|
||||||
/// We sent last message at `last_sent`
|
/// We sent last message at `last_sent`
|
||||||
last_sent: Duration,
|
last_sent: Duration,
|
||||||
hooks: EMH,
|
hooks: EMH,
|
||||||
@ -98,6 +100,7 @@ impl LlmpEventManager<(), NopState<NopInput>, NopShMemProvider> {
|
|||||||
pub struct LlmpEventManagerBuilder<EMH> {
|
pub struct LlmpEventManagerBuilder<EMH> {
|
||||||
throttle: Option<Duration>,
|
throttle: Option<Duration>,
|
||||||
hooks: EMH,
|
hooks: EMH,
|
||||||
|
always_interesting: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for LlmpEventManagerBuilder<()> {
|
impl Default for LlmpEventManagerBuilder<()> {
|
||||||
@ -113,6 +116,7 @@ impl LlmpEventManagerBuilder<()> {
|
|||||||
Self {
|
Self {
|
||||||
throttle: None,
|
throttle: None,
|
||||||
hooks: (),
|
hooks: (),
|
||||||
|
always_interesting: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +125,17 @@ impl LlmpEventManagerBuilder<()> {
|
|||||||
LlmpEventManagerBuilder {
|
LlmpEventManagerBuilder {
|
||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
hooks,
|
hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set `always_interesting`
|
||||||
|
#[must_use]
|
||||||
|
pub fn always_interesting(self, always_interesting: bool) -> LlmpEventManagerBuilder<()> {
|
||||||
|
LlmpEventManagerBuilder {
|
||||||
|
throttle: self.throttle,
|
||||||
|
hooks: self.hooks,
|
||||||
|
always_interesting,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,6 +164,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
|
|||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
last_sent: Duration::from_secs(0),
|
last_sent: Duration::from_secs(0),
|
||||||
hooks: self.hooks,
|
hooks: self.hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
||||||
@ -178,6 +194,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
|
|||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
last_sent: Duration::from_secs(0),
|
last_sent: Duration::from_secs(0),
|
||||||
hooks: self.hooks,
|
hooks: self.hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
||||||
@ -208,6 +225,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
|
|||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
last_sent: Duration::from_secs(0),
|
last_sent: Duration::from_secs(0),
|
||||||
hooks: self.hooks,
|
hooks: self.hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
||||||
@ -242,6 +260,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
|
|||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
last_sent: Duration::from_secs(0),
|
last_sent: Duration::from_secs(0),
|
||||||
hooks: self.hooks,
|
hooks: self.hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
||||||
@ -270,6 +289,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
|
|||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
last_sent: Duration::from_secs(0),
|
last_sent: Duration::from_secs(0),
|
||||||
hooks: self.hooks,
|
hooks: self.hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
||||||
@ -302,6 +322,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
|
|||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
last_sent: Duration::from_secs(0),
|
last_sent: Duration::from_secs(0),
|
||||||
hooks: self.hooks,
|
hooks: self.hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
||||||
@ -329,6 +350,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
|
|||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
last_sent: Duration::from_secs(0),
|
last_sent: Duration::from_secs(0),
|
||||||
hooks: self.hooks,
|
hooks: self.hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
||||||
@ -360,6 +382,7 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
|
|||||||
throttle: self.throttle,
|
throttle: self.throttle,
|
||||||
last_sent: Duration::from_secs(0),
|
last_sent: Duration::from_secs(0),
|
||||||
hooks: self.hooks,
|
hooks: self.hooks,
|
||||||
|
always_interesting: self.always_interesting,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::with_threshold(COMPRESS_THRESHOLD),
|
||||||
@ -506,7 +529,9 @@ where
|
|||||||
where
|
where
|
||||||
E: Executor<Self, Z> + HasObservers<State = S>,
|
E: Executor<Self, Z> + HasObservers<State = S>,
|
||||||
for<'a> E::Observers: Deserialize<'a>,
|
for<'a> E::Observers: Deserialize<'a>,
|
||||||
Z: ExecutionProcessor<E::Observers, State = S> + EvaluatorObservers<E::Observers>,
|
Z: ExecutionProcessor<E::Observers, State = S>
|
||||||
|
+ EvaluatorObservers<E::Observers>
|
||||||
|
+ Evaluator<E, Self>,
|
||||||
{
|
{
|
||||||
if !self.hooks.pre_exec_all(state, client_id, &event)? {
|
if !self.hooks.pre_exec_all(state, client_id, &event)? {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@ -524,6 +549,10 @@ where
|
|||||||
} => {
|
} => {
|
||||||
log::info!("Received new Testcase from {client_id:?} ({client_config:?}, forward {forward_id:?})");
|
log::info!("Received new Testcase from {client_id:?} ({client_config:?}, forward {forward_id:?})");
|
||||||
|
|
||||||
|
if self.always_interesting {
|
||||||
|
let item = fuzzer.add_input(state, executor, self, input)?;
|
||||||
|
log::info!("Added received Testcase as item #{item}");
|
||||||
|
} else {
|
||||||
let res = if client_config.match_with(&self.configuration)
|
let res = if client_config.match_with(&self.configuration)
|
||||||
&& observers_buf.is_some()
|
&& observers_buf.is_some()
|
||||||
{
|
{
|
||||||
@ -539,7 +568,9 @@ where
|
|||||||
{
|
{
|
||||||
state.scalability_monitor_mut().testcase_with_observers += 1;
|
state.scalability_monitor_mut().testcase_with_observers += 1;
|
||||||
}
|
}
|
||||||
fuzzer.execute_and_process(state, self, input, &observers, &exit_kind, false)?
|
fuzzer.execute_and_process(
|
||||||
|
state, self, input, &observers, &exit_kind, false,
|
||||||
|
)?
|
||||||
} else {
|
} else {
|
||||||
#[cfg(feature = "scalability_introspection")]
|
#[cfg(feature = "scalability_introspection")]
|
||||||
{
|
{
|
||||||
@ -553,6 +584,7 @@ where
|
|||||||
log::info!("Added received Testcase as item #{item}");
|
log::info!("Added received Testcase as item #{item}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Event::CustomBuf { tag, buf } => {
|
Event::CustomBuf { tag, buf } => {
|
||||||
for handler in &mut self.custom_buf_handlers {
|
for handler in &mut self.custom_buf_handlers {
|
||||||
if handler(state, &tag, &buf)? == CustomBufEventResult::Handled {
|
if handler(state, &tag, &buf)? == CustomBufEventResult::Handled {
|
||||||
@ -686,7 +718,9 @@ where
|
|||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
E: HasObservers<State = S> + Executor<Self, Z>,
|
E: HasObservers<State = S> + Executor<Self, Z>,
|
||||||
for<'a> E::Observers: Deserialize<'a>,
|
for<'a> E::Observers: Deserialize<'a>,
|
||||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
|
Z: ExecutionProcessor<E::Observers, State = S>
|
||||||
|
+ EvaluatorObservers<E::Observers>
|
||||||
|
+ Evaluator<E, Self>,
|
||||||
{
|
{
|
||||||
fn process(
|
fn process(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -732,7 +766,9 @@ where
|
|||||||
EMH: EventManagerHooksTuple<S>,
|
EMH: EventManagerHooksTuple<S>,
|
||||||
S: State + HasExecutions + HasMetadata + HasLastReportTime,
|
S: State + HasExecutions + HasMetadata + HasLastReportTime,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
|
Z: ExecutionProcessor<E::Observers, State = S>
|
||||||
|
+ EvaluatorObservers<E::Observers>
|
||||||
|
+ Evaluator<E, Self>,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ use crate::{
|
|||||||
LlmpEventManager, LlmpShouldSaveState, ProgressReporter,
|
LlmpEventManager, LlmpShouldSaveState, ProgressReporter,
|
||||||
},
|
},
|
||||||
executors::{Executor, HasObservers},
|
executors::{Executor, HasObservers},
|
||||||
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
fuzzer::{Evaluator, EvaluatorObservers, ExecutionProcessor},
|
||||||
inputs::UsesInput,
|
inputs::UsesInput,
|
||||||
monitors::Monitor,
|
monitors::Monitor,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
@ -219,7 +219,9 @@ where
|
|||||||
EMH: EventManagerHooksTuple<S>,
|
EMH: EventManagerHooksTuple<S>,
|
||||||
S: State + HasExecutions + HasMetadata,
|
S: State + HasExecutions + HasMetadata,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
|
Z: ExecutionProcessor<E::Observers, State = S>
|
||||||
|
+ EvaluatorObservers<E::Observers>
|
||||||
|
+ Evaluator<E, LlmpEventManager<EMH, S, SP>>,
|
||||||
{
|
{
|
||||||
fn process(&mut self, fuzzer: &mut Z, state: &mut S, executor: &mut E) -> Result<usize, Error> {
|
fn process(&mut self, fuzzer: &mut Z, state: &mut S, executor: &mut E) -> Result<usize, Error> {
|
||||||
let res = self.llmp_mgr.process(fuzzer, state, executor)?;
|
let res = self.llmp_mgr.process(fuzzer, state, executor)?;
|
||||||
@ -236,7 +238,9 @@ where
|
|||||||
EMH: EventManagerHooksTuple<S>,
|
EMH: EventManagerHooksTuple<S>,
|
||||||
S: State + HasExecutions + HasMetadata + HasLastReportTime,
|
S: State + HasExecutions + HasMetadata + HasLastReportTime,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
|
Z: ExecutionProcessor<E::Observers, State = S>
|
||||||
|
+ EvaluatorObservers<E::Observers>
|
||||||
|
+ Evaluator<E, LlmpEventManager<EMH, S, SP>>,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,6 +406,9 @@ where
|
|||||||
/// The shared memory provider to use for the broker or client spawned by the restarting
|
/// The shared memory provider to use for the broker or client spawned by the restarting
|
||||||
/// manager.
|
/// manager.
|
||||||
shmem_provider: SP,
|
shmem_provider: SP,
|
||||||
|
#[builder(default = false)]
|
||||||
|
/// Consider this testcase as interesting always if true
|
||||||
|
always_interesting: bool,
|
||||||
/// The configuration
|
/// The configuration
|
||||||
configuration: EventConfig,
|
configuration: EventConfig,
|
||||||
/// The monitor to use
|
/// The monitor to use
|
||||||
@ -487,10 +494,12 @@ where
|
|||||||
LlmpConnection::IsClient { client } => {
|
LlmpConnection::IsClient { client } => {
|
||||||
#[cfg(not(feature = "adaptive_serialization"))]
|
#[cfg(not(feature = "adaptive_serialization"))]
|
||||||
let mgr: LlmpEventManager<EMH, S, SP> = LlmpEventManager::builder()
|
let mgr: LlmpEventManager<EMH, S, SP> = LlmpEventManager::builder()
|
||||||
|
.always_interesting(self.always_interesting)
|
||||||
.hooks(self.hooks)
|
.hooks(self.hooks)
|
||||||
.build_from_client(client, self.configuration)?;
|
.build_from_client(client, self.configuration)?;
|
||||||
#[cfg(feature = "adaptive_serialization")]
|
#[cfg(feature = "adaptive_serialization")]
|
||||||
let mgr: LlmpEventManager<EMH, S, SP> = LlmpEventManager::builder()
|
let mgr: LlmpEventManager<EMH, S, SP> = LlmpEventManager::builder()
|
||||||
|
.always_interesting(self.always_interesting)
|
||||||
.hooks(self.hooks)
|
.hooks(self.hooks)
|
||||||
.build_from_client(
|
.build_from_client(
|
||||||
client,
|
client,
|
||||||
@ -515,6 +524,7 @@ where
|
|||||||
// We are a client
|
// We are a client
|
||||||
#[cfg(not(feature = "adaptive_serialization"))]
|
#[cfg(not(feature = "adaptive_serialization"))]
|
||||||
let mgr = LlmpEventManager::builder()
|
let mgr = LlmpEventManager::builder()
|
||||||
|
.always_interesting(self.always_interesting)
|
||||||
.hooks(self.hooks)
|
.hooks(self.hooks)
|
||||||
.build_on_port(
|
.build_on_port(
|
||||||
self.shmem_provider.clone(),
|
self.shmem_provider.clone(),
|
||||||
@ -523,6 +533,7 @@ where
|
|||||||
)?;
|
)?;
|
||||||
#[cfg(feature = "adaptive_serialization")]
|
#[cfg(feature = "adaptive_serialization")]
|
||||||
let mgr = LlmpEventManager::builder()
|
let mgr = LlmpEventManager::builder()
|
||||||
|
.always_interesting(self.always_interesting)
|
||||||
.hooks(self.hooks)
|
.hooks(self.hooks)
|
||||||
.build_on_port(
|
.build_on_port(
|
||||||
self.shmem_provider.clone(),
|
self.shmem_provider.clone(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user