parent
8245c7eda9
commit
d6ee2dbe12
@ -77,9 +77,8 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Perform the stage if closure evaluates to true
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct IfElseStage<CB, E, EM, ST, Z>
|
pub struct IfStage<CB, E, EM, ST, Z>
|
||||||
where
|
where
|
||||||
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
||||||
E: UsesState,
|
E: UsesState,
|
||||||
@ -89,11 +88,10 @@ where
|
|||||||
{
|
{
|
||||||
closure: CB,
|
closure: CB,
|
||||||
if_stages: ST,
|
if_stages: ST,
|
||||||
else_stages: ST,
|
|
||||||
phantom: PhantomData<(E, EM, Z)>,
|
phantom: PhantomData<(E, EM, Z)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<CB, E, EM, ST, Z> UsesState for IfElseStage<CB, E, EM, ST, Z>
|
impl<CB, E, EM, ST, Z> UsesState for IfStage<CB, E, EM, ST, Z>
|
||||||
where
|
where
|
||||||
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
||||||
E: UsesState,
|
E: UsesState,
|
||||||
@ -104,13 +102,85 @@ where
|
|||||||
type State = E::State;
|
type State = E::State;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<CB, E, EM, ST, Z> Stage<E, EM, Z> for IfElseStage<CB, E, EM, ST, Z>
|
impl<CB, E, EM, ST, Z> Stage<E, EM, Z> for IfStage<CB, E, EM, ST, Z>
|
||||||
where
|
where
|
||||||
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
||||||
E: UsesState,
|
E: UsesState,
|
||||||
EM: UsesState<State = E::State>,
|
EM: UsesState<State = E::State>,
|
||||||
ST: StagesTuple<E, EM, E::State, Z>,
|
ST: StagesTuple<E, EM, E::State, Z>,
|
||||||
Z: UsesState<State = E::State>,
|
Z: UsesState<State = E::State>,
|
||||||
|
{
|
||||||
|
fn perform(
|
||||||
|
&mut self,
|
||||||
|
fuzzer: &mut Z,
|
||||||
|
executor: &mut E,
|
||||||
|
state: &mut E::State,
|
||||||
|
manager: &mut EM,
|
||||||
|
corpus_idx: CorpusId,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
if (self.closure)(fuzzer, executor, state, manager, corpus_idx)? {
|
||||||
|
self.if_stages
|
||||||
|
.perform_all(fuzzer, executor, state, manager, corpus_idx)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<CB, E, EM, ST, Z> IfStage<CB, E, EM, ST, Z>
|
||||||
|
where
|
||||||
|
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
||||||
|
E: UsesState,
|
||||||
|
EM: UsesState<State = E::State>,
|
||||||
|
ST: StagesTuple<E, EM, E::State, Z>,
|
||||||
|
Z: UsesState<State = E::State>,
|
||||||
|
{
|
||||||
|
/// Constructor
|
||||||
|
pub fn new(closure: CB, if_stages: ST) -> Self {
|
||||||
|
Self {
|
||||||
|
closure,
|
||||||
|
if_stages,
|
||||||
|
phantom: PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Perform the stage if closure evaluates to true
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct IfElseStage<CB, E, EM, ST1, ST2, Z>
|
||||||
|
where
|
||||||
|
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
||||||
|
E: UsesState,
|
||||||
|
EM: UsesState<State = E::State>,
|
||||||
|
ST1: StagesTuple<E, EM, E::State, Z>,
|
||||||
|
ST2: StagesTuple<E, EM, E::State, Z>,
|
||||||
|
Z: UsesState<State = E::State>,
|
||||||
|
{
|
||||||
|
closure: CB,
|
||||||
|
if_stages: ST1,
|
||||||
|
else_stages: ST2,
|
||||||
|
phantom: PhantomData<(E, EM, Z)>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<CB, E, EM, ST1, ST2, Z> UsesState for IfElseStage<CB, E, EM, ST1, ST2, Z>
|
||||||
|
where
|
||||||
|
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
||||||
|
E: UsesState,
|
||||||
|
EM: UsesState<State = E::State>,
|
||||||
|
ST1: StagesTuple<E, EM, E::State, Z>,
|
||||||
|
ST2: StagesTuple<E, EM, E::State, Z>,
|
||||||
|
Z: UsesState<State = E::State>,
|
||||||
|
{
|
||||||
|
type State = E::State;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<CB, E, EM, ST1, ST2, Z> Stage<E, EM, Z> for IfElseStage<CB, E, EM, ST1, ST2, Z>
|
||||||
|
where
|
||||||
|
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
||||||
|
E: UsesState,
|
||||||
|
EM: UsesState<State = E::State>,
|
||||||
|
ST1: StagesTuple<E, EM, E::State, Z>,
|
||||||
|
ST2: StagesTuple<E, EM, E::State, Z>,
|
||||||
|
Z: UsesState<State = E::State>,
|
||||||
{
|
{
|
||||||
fn perform(
|
fn perform(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -131,16 +201,17 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<CB, E, EM, ST, Z> IfElseStage<CB, E, EM, ST, Z>
|
impl<CB, E, EM, ST1, ST2, Z> IfElseStage<CB, E, EM, ST1, ST2, Z>
|
||||||
where
|
where
|
||||||
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
CB: FnMut(&mut Z, &mut E, &mut E::State, &mut EM, CorpusId) -> Result<bool, Error>,
|
||||||
E: UsesState,
|
E: UsesState,
|
||||||
EM: UsesState<State = E::State>,
|
EM: UsesState<State = E::State>,
|
||||||
ST: StagesTuple<E, EM, E::State, Z>,
|
ST1: StagesTuple<E, EM, E::State, Z>,
|
||||||
|
ST2: StagesTuple<E, EM, E::State, Z>,
|
||||||
Z: UsesState<State = E::State>,
|
Z: UsesState<State = E::State>,
|
||||||
{
|
{
|
||||||
/// Constructor
|
/// Constructor
|
||||||
pub fn new(closure: CB, if_stages: ST, else_stages: ST) -> Self {
|
pub fn new(closure: CB, if_stages: ST1, else_stages: ST2) -> Self {
|
||||||
Self {
|
Self {
|
||||||
closure,
|
closure,
|
||||||
if_stages,
|
if_stages,
|
||||||
|
@ -1672,7 +1672,9 @@ impl AsanRuntime {
|
|||||||
|
|
||||||
// apple aarch64 requires MAP_JIT to allocates WX pages
|
// apple aarch64 requires MAP_JIT to allocates WX pages
|
||||||
#[cfg(all(target_vendor = "apple", target_arch = "aarch64"))]
|
#[cfg(all(target_vendor = "apple", target_arch = "aarch64"))]
|
||||||
|
{
|
||||||
map_flags |= MapFlags::MAP_JIT;
|
map_flags |= MapFlags::MAP_JIT;
|
||||||
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mapping = mmap(
|
let mapping = mmap(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user