release settings changed
This commit is contained in:
parent
6e81c259f7
commit
7af0ae421e
@ -21,7 +21,11 @@ harness = false
|
|||||||
name = "hash_speeds"
|
name = "hash_speeds"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
opt-level = 3
|
||||||
|
debug = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
|
@ -213,14 +213,15 @@ where
|
|||||||
if !self.add_if_interesting(corpus, input, fitness)?.is_none() {
|
if !self.add_if_interesting(corpus, input, fitness)?.is_none() {
|
||||||
added += 1;
|
added += 1;
|
||||||
}
|
}
|
||||||
manager.fire(
|
manager.fire(Event::LoadInitial {
|
||||||
Event::LoadInitial {
|
|
||||||
sender_id: 0,
|
sender_id: 0,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
|
})?;
|
||||||
}
|
}
|
||||||
)?;
|
manager.fire(Event::log(
|
||||||
}
|
0,
|
||||||
manager.fire(Event::log(0, format!("Loaded {} over {} initial testcases", added, num)))?;
|
format!("Loaded {} over {} initial testcases", added, num),
|
||||||
|
))?;
|
||||||
manager.process(self, corpus)?;
|
manager.process(self, corpus)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -318,7 +319,10 @@ where
|
|||||||
let cur = current_milliseconds();
|
let cur = current_milliseconds();
|
||||||
if cur - last > 60 * 100 {
|
if cur - last > 60 * 100 {
|
||||||
last = cur;
|
last = cur;
|
||||||
manager.fire(Event::update_stats(state.executions(), state.executions_over_seconds()))?;
|
manager.fire(Event::update_stats(
|
||||||
|
state.executions(),
|
||||||
|
state.executions_over_seconds(),
|
||||||
|
))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ where
|
|||||||
sender_id: u64,
|
sender_id: u64,
|
||||||
input: Ptr<'a, I>,
|
input: Ptr<'a, I>,
|
||||||
observers: PtrMut<'a, crate::observers::observer_serde::NamedSerdeAnyMap>,
|
observers: PtrMut<'a, crate::observers::observer_serde::NamedSerdeAnyMap>,
|
||||||
corpus_count: usize
|
corpus_count: usize,
|
||||||
},
|
},
|
||||||
UpdateStats {
|
UpdateStats {
|
||||||
sender_id: u64,
|
sender_id: u64,
|
||||||
@ -109,7 +109,7 @@ where
|
|||||||
sender_id: _,
|
sender_id: _,
|
||||||
input: _,
|
input: _,
|
||||||
observers: _,
|
observers: _,
|
||||||
corpus_count: _
|
corpus_count: _,
|
||||||
} => "New Testcase",
|
} => "New Testcase",
|
||||||
Event::UpdateStats {
|
Event::UpdateStats {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
@ -135,7 +135,7 @@ where
|
|||||||
} => "Log",
|
} => "Log",
|
||||||
Event::None { phantom: _ } => "None",
|
Event::None { phantom: _ } => "None",
|
||||||
Event::Custom {
|
Event::Custom {
|
||||||
sender_id, /*custom_event} => custom_event.name()*/
|
sender_id: _, /*custom_event} => custom_event.name()*/
|
||||||
} => "todo",
|
} => "todo",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,10 +167,7 @@ where
|
|||||||
R: Rand,
|
R: Rand,
|
||||||
{
|
{
|
||||||
/// Fire an Event
|
/// Fire an Event
|
||||||
fn fire<'a>(
|
fn fire<'a>(&mut self, event: Event<'a, I>) -> Result<(), AflError>;
|
||||||
&mut self,
|
|
||||||
event: Event<'a, I>
|
|
||||||
) -> Result<(), AflError>;
|
|
||||||
|
|
||||||
/// Lookup for incoming events and process them.
|
/// Lookup for incoming events and process them.
|
||||||
/// Return the number of processes events or an error
|
/// Return the number of processes events or an error
|
||||||
@ -183,10 +180,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO the broker has a state? do we need to pass state and corpus?
|
// TODO the broker has a state? do we need to pass state and corpus?
|
||||||
fn handle_in_broker(
|
fn handle_in_broker(&mut self, event: &Event<I>) -> Result<BrokerEventResult, AflError> {
|
||||||
&mut self,
|
|
||||||
event: &Event<I>,
|
|
||||||
) -> Result<BrokerEventResult, AflError> {
|
|
||||||
match event {
|
match event {
|
||||||
Event::LoadInitial {
|
Event::LoadInitial {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
@ -196,7 +190,7 @@ where
|
|||||||
sender_id: _,
|
sender_id: _,
|
||||||
input: _,
|
input: _,
|
||||||
observers: _,
|
observers: _,
|
||||||
corpus_count: _
|
corpus_count: _,
|
||||||
} => Ok(BrokerEventResult::Forward),
|
} => Ok(BrokerEventResult::Forward),
|
||||||
Event::UpdateStats {
|
Event::UpdateStats {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
@ -233,7 +227,7 @@ where
|
|||||||
}
|
}
|
||||||
Event::None { phantom: _ } => Ok(BrokerEventResult::Handled),
|
Event::None { phantom: _ } => Ok(BrokerEventResult::Handled),
|
||||||
Event::Custom {
|
Event::Custom {
|
||||||
sender_id, /*custom_event} => custom_event.handle_in_broker(state, corpus)*/
|
sender_id: _, /*custom_event} => custom_event.handle_in_broker(state, corpus)*/
|
||||||
} => Ok(BrokerEventResult::Forward),
|
} => Ok(BrokerEventResult::Forward),
|
||||||
//_ => Ok(BrokerEventResult::Forward),
|
//_ => Ok(BrokerEventResult::Forward),
|
||||||
}
|
}
|
||||||
@ -250,7 +244,7 @@ where
|
|||||||
sender_id: _,
|
sender_id: _,
|
||||||
input: _,
|
input: _,
|
||||||
observers: _,
|
observers: _,
|
||||||
corpus_count: _
|
corpus_count: _,
|
||||||
} => {
|
} => {
|
||||||
// here u should match sender_id, if equal to the current one do not re-execute
|
// here u should match sender_id, if equal to the current one do not re-execute
|
||||||
// we need to pass engine to process() too, TODO
|
// we need to pass engine to process() too, TODO
|
||||||
@ -304,10 +298,7 @@ where
|
|||||||
W: Write,
|
W: Write,
|
||||||
//CE: CustomEvent<I>,
|
//CE: CustomEvent<I>,
|
||||||
{
|
{
|
||||||
fn fire<'a>(
|
fn fire<'a>(&mut self, event: Event<'a, I>) -> Result<(), AflError> {
|
||||||
&mut self,
|
|
||||||
event: Event<'a, I>,
|
|
||||||
) -> Result<(), AflError> {
|
|
||||||
match self.handle_in_broker(&event)? {
|
match self.handle_in_broker(&event)? {
|
||||||
BrokerEventResult::Forward => (), //self.handle_in_client(event, state, corpus)?,
|
BrokerEventResult::Forward => (), //self.handle_in_client(event, state, corpus)?,
|
||||||
// Ignore broker-only events
|
// Ignore broker-only events
|
||||||
@ -322,21 +313,22 @@ where
|
|||||||
Ok(c)
|
Ok(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_in_broker(
|
fn handle_in_broker(&mut self, event: &Event<I>) -> Result<BrokerEventResult, AflError> {
|
||||||
&mut self,
|
|
||||||
event: &Event<I>,
|
|
||||||
) -> Result<BrokerEventResult, AflError> {
|
|
||||||
match event {
|
match event {
|
||||||
Event::NewTestcase {
|
Event::NewTestcase {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
input: _,
|
input: _,
|
||||||
observers: _,
|
observers: _,
|
||||||
corpus_count
|
corpus_count,
|
||||||
} => {
|
} => {
|
||||||
self.corpus_count = *corpus_count;
|
self.corpus_count = *corpus_count;
|
||||||
writeln!(self.writer, "[NEW] corpus: {} execs: {} execs/s: {}", self.corpus_count, self.executions, self.execs_over_sec);
|
writeln!(
|
||||||
|
self.writer,
|
||||||
|
"[NEW] corpus: {} execs: {} execs/s: {}",
|
||||||
|
self.corpus_count, self.executions, self.execs_over_sec
|
||||||
|
)?;
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
},
|
}
|
||||||
Event::UpdateStats {
|
Event::UpdateStats {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
executions,
|
executions,
|
||||||
@ -345,7 +337,11 @@ where
|
|||||||
} => {
|
} => {
|
||||||
self.executions = *executions;
|
self.executions = *executions;
|
||||||
self.execs_over_sec = *execs_over_sec;
|
self.execs_over_sec = *execs_over_sec;
|
||||||
writeln!(self.writer, "[UPDATE] corpus: {} execs: {} execs/s: {}", self.corpus_count, self.executions, self.execs_over_sec);
|
writeln!(
|
||||||
|
self.writer,
|
||||||
|
"[UPDATE] corpus: {} execs: {} execs/s: {}",
|
||||||
|
self.corpus_count, self.executions, self.execs_over_sec
|
||||||
|
)?;
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::Crash {
|
Event::Crash {
|
||||||
@ -354,7 +350,7 @@ where
|
|||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
panic!("LoggerEventManager cannot handle Event::Crash");
|
panic!("LoggerEventManager cannot handle Event::Crash");
|
||||||
},
|
}
|
||||||
Event::Timeout {
|
Event::Timeout {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
input: _,
|
input: _,
|
||||||
@ -363,12 +359,12 @@ where
|
|||||||
panic!("LoggerEventManager cannot handle Event::Timeout");
|
panic!("LoggerEventManager cannot handle Event::Timeout");
|
||||||
}
|
}
|
||||||
Event::Log {
|
Event::Log {
|
||||||
sender_id,
|
sender_id: _,
|
||||||
severity_level,
|
severity_level,
|
||||||
message,
|
message,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
writeln!(self.writer, "[LOG {}]: {}", severity_level, message);
|
writeln!(self.writer, "[LOG {}]: {}", severity_level, message)?;
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
_ => Ok(BrokerEventResult::Handled),
|
_ => Ok(BrokerEventResult::Handled),
|
||||||
@ -417,10 +413,10 @@ where
|
|||||||
const LLMP_TAG_EVENT_TO_CLIENT: llmp::Tag = 0x2C11E471;
|
const LLMP_TAG_EVENT_TO_CLIENT: llmp::Tag = 0x2C11E471;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
/// Only handle this in the broker
|
/// Only handle this in the broker
|
||||||
const LLMP_TAG_EVENT_TO_BROKER: llmp::Tag = 0x2B80438;
|
const _LLMP_TAG_EVENT_TO_BROKER: llmp::Tag = 0x2B80438;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
/// Handle in both
|
/// Handle in both
|
||||||
const LLMP_TAG_EVENT_TO_BOTH: llmp::Tag = 0x2B0741;
|
const _LLMP_TAG_EVENT_TO_BOTH: llmp::Tag = 0x2B0741;
|
||||||
|
|
||||||
/// Eventmanager for multi-processed application
|
/// Eventmanager for multi-processed application
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
@ -432,7 +428,7 @@ where
|
|||||||
R: Rand,
|
R: Rand,
|
||||||
//CE: CustomEvent<I>,
|
//CE: CustomEvent<I>,
|
||||||
{
|
{
|
||||||
llmp_client: llmp::LlmpClient,
|
_llmp_client: llmp::LlmpClient,
|
||||||
phantom: PhantomData<(C, E, I, R)>,
|
phantom: PhantomData<(C, E, I, R)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,10 +441,7 @@ where
|
|||||||
R: Rand,
|
R: Rand,
|
||||||
{
|
{
|
||||||
/// Fire an Event
|
/// Fire an Event
|
||||||
fn fire<'a>(
|
fn fire<'a>(&mut self, event: Event<'a, I>) -> Result<(), AflError> {
|
||||||
&mut self,
|
|
||||||
event: Event<'a, I>,
|
|
||||||
) -> Result<(), AflError> {
|
|
||||||
let serialized = postcard::to_allocvec(&event)?;
|
let serialized = postcard::to_allocvec(&event)?;
|
||||||
self.llmp_broker
|
self.llmp_broker
|
||||||
.send_buf(LLMP_TAG_EVENT_TO_CLIENT, &serialized)?;
|
.send_buf(LLMP_TAG_EVENT_TO_CLIENT, &serialized)?;
|
||||||
@ -490,10 +483,7 @@ where
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_in_broker(
|
fn handle_in_broker(&mut self, event: &Event<I>) -> Result<BrokerEventResult, AflError> {
|
||||||
&mut self,
|
|
||||||
event: &Event<I>,
|
|
||||||
) -> Result<BrokerEventResult, AflError> {
|
|
||||||
match event {
|
match event {
|
||||||
Event::LoadInitial {
|
Event::LoadInitial {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
@ -503,7 +493,7 @@ where
|
|||||||
sender_id: _,
|
sender_id: _,
|
||||||
input: _,
|
input: _,
|
||||||
observers: _,
|
observers: _,
|
||||||
corpus_count: _
|
corpus_count: _,
|
||||||
} => Ok(BrokerEventResult::Forward),
|
} => Ok(BrokerEventResult::Forward),
|
||||||
Event::UpdateStats {
|
Event::UpdateStats {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
@ -540,7 +530,7 @@ where
|
|||||||
}
|
}
|
||||||
Event::None { phantom: _ } => Ok(BrokerEventResult::Handled),
|
Event::None { phantom: _ } => Ok(BrokerEventResult::Handled),
|
||||||
Event::Custom {
|
Event::Custom {
|
||||||
sender_id, /*custom_event} => custom_event.handle_in_broker(state, corpus)*/
|
sender_id: _, /*custom_event} => custom_event.handle_in_broker(state, corpus)*/
|
||||||
} => Ok(BrokerEventResult::Forward),
|
} => Ok(BrokerEventResult::Forward),
|
||||||
//_ => Ok(BrokerEventResult::Forward),
|
//_ => Ok(BrokerEventResult::Forward),
|
||||||
}
|
}
|
||||||
@ -550,14 +540,14 @@ where
|
|||||||
&mut self,
|
&mut self,
|
||||||
event: Event<I>,
|
event: Event<I>,
|
||||||
/*client: &dyn EventManager<C, E, I, R>,*/ _state: &mut State<I, R>,
|
/*client: &dyn EventManager<C, E, I, R>,*/ _state: &mut State<I, R>,
|
||||||
corpus: &mut C,
|
_corpus: &mut C,
|
||||||
) -> Result<(), AflError> {
|
) -> Result<(), AflError> {
|
||||||
match event {
|
match event {
|
||||||
Event::NewTestcase {
|
Event::NewTestcase {
|
||||||
sender_id: _,
|
sender_id: _,
|
||||||
input: _,
|
input: _,
|
||||||
observers: _,
|
observers: _,
|
||||||
corpus_count: _
|
corpus_count: _,
|
||||||
} => {
|
} => {
|
||||||
// here u should match sender_id, if equal to the current one do not re-execute
|
// here u should match sender_id, if equal to the current one do not re-execute
|
||||||
// we need to pass engine to process() too, TODO
|
// we need to pass engine to process() too, TODO
|
||||||
@ -599,7 +589,7 @@ mod tests {
|
|||||||
sender_id: 0,
|
sender_id: 0,
|
||||||
input: Ptr::Ref(&i),
|
input: Ptr::Ref(&i),
|
||||||
observers: PtrMut::Ref(&mut map),
|
observers: PtrMut::Ref(&mut map),
|
||||||
corpus_count: 1
|
corpus_count: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
let j = serde_json::to_string(&e).unwrap();
|
let j = serde_json::to_string(&e).unwrap();
|
||||||
@ -610,7 +600,7 @@ mod tests {
|
|||||||
sender_id: _,
|
sender_id: _,
|
||||||
input: _,
|
input: _,
|
||||||
observers: obs,
|
observers: obs,
|
||||||
corpus_count: _
|
corpus_count: _,
|
||||||
} => {
|
} => {
|
||||||
let o = obs
|
let o = obs
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -3,8 +3,6 @@ pub use bytes::BytesInput;
|
|||||||
|
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::clone::Clone;
|
use core::clone::Clone;
|
||||||
#[cfg(feature = "std")]
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::Deserialize;
|
||||||
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
|
@ -68,14 +68,12 @@ where
|
|||||||
let testcase_maybe = state.testcase_if_interesting(input_mut, fitness)?;
|
let testcase_maybe = state.testcase_if_interesting(input_mut, fitness)?;
|
||||||
if let Some(mut testcase) = testcase_maybe {
|
if let Some(mut testcase) = testcase_maybe {
|
||||||
// TODO decouple events manager and engine
|
// TODO decouple events manager and engine
|
||||||
manager.fire(
|
manager.fire(Event::NewTestcase {
|
||||||
Event::NewTestcase {
|
|
||||||
sender_id: 0,
|
sender_id: 0,
|
||||||
input: Ptr::Ref(testcase.load_input()?),
|
input: Ptr::Ref(testcase.load_input()?),
|
||||||
observers: PtrMut::Ref(engine.executor_mut().observers_mut()),
|
observers: PtrMut::Ref(engine.executor_mut().observers_mut()),
|
||||||
corpus_count: corpus.count() +1
|
corpus_count: corpus.count() + 1,
|
||||||
}
|
})?;
|
||||||
)?;
|
|
||||||
let _ = corpus.add(testcase);
|
let _ = corpus.add(testcase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,12 @@ edition = "2018"
|
|||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = []
|
std = []
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
opt-level = 3
|
||||||
|
debug = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
afl = { path = "../../afl/" }
|
afl = { path = "../../afl/" }
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ use afl::observers::StdMapObserver;
|
|||||||
use afl::stages::mutational::StdMutationalStage;
|
use afl::stages::mutational::StdMutationalStage;
|
||||||
use afl::utils::StdRand;
|
use afl::utils::StdRand;
|
||||||
|
|
||||||
const MAP_SIZE: usize = 65536;
|
// const MAP_SIZE: usize = 65536;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user