libafl-fuzz: add IndexesLenMinTimeScheduler back (#2426)
This commit is contained in:
parent
78a30c4403
commit
c22a62c32a
@ -15,7 +15,10 @@ use libafl::{
|
|||||||
scheduled::havoc_mutations, tokens_mutations, AFLppRedQueen, StdScheduledMutator, Tokens,
|
scheduled::havoc_mutations, tokens_mutations, AFLppRedQueen, StdScheduledMutator, Tokens,
|
||||||
},
|
},
|
||||||
observers::{CanTrack, HitcountsMapObserver, StdMapObserver, TimeObserver},
|
observers::{CanTrack, HitcountsMapObserver, StdMapObserver, TimeObserver},
|
||||||
schedulers::{powersched::PowerSchedule, QueueScheduler, StdWeightedScheduler},
|
schedulers::{
|
||||||
|
powersched::PowerSchedule, IndexesLenTimeMinimizerScheduler, QueueScheduler,
|
||||||
|
StdWeightedScheduler,
|
||||||
|
},
|
||||||
stages::{
|
stages::{
|
||||||
mutational::MultiMutationalStage, CalibrationStage, ColorizationStage, IfStage,
|
mutational::MultiMutationalStage, CalibrationStage, ColorizationStage, IfStage,
|
||||||
StagesTuple, StdMutationalStage, StdPowerMutationalStage, SyncFromDiskStage,
|
StagesTuple, StdMutationalStage, StdPowerMutationalStage, SyncFromDiskStage,
|
||||||
@ -183,7 +186,10 @@ where
|
|||||||
weighted_scheduler = weighted_scheduler.cycling_scheduler();
|
weighted_scheduler = weighted_scheduler.cycling_scheduler();
|
||||||
}
|
}
|
||||||
// TODO: Go back to IndexesLenTimeMinimizerScheduler once AflScheduler is implemented for it.
|
// TODO: Go back to IndexesLenTimeMinimizerScheduler once AflScheduler is implemented for it.
|
||||||
scheduler = SupportedSchedulers::Weighted(weighted_scheduler, PhantomData);
|
scheduler = SupportedSchedulers::Weighted(
|
||||||
|
IndexesLenTimeMinimizerScheduler::new(&edges_observer, weighted_scheduler),
|
||||||
|
PhantomData,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create our Fuzzer
|
// Create our Fuzzer
|
||||||
|
@ -3,29 +3,33 @@ use std::marker::PhantomData;
|
|||||||
use libafl::{
|
use libafl::{
|
||||||
corpus::{CorpusId, HasTestcase, Testcase},
|
corpus::{CorpusId, HasTestcase, Testcase},
|
||||||
inputs::UsesInput,
|
inputs::UsesInput,
|
||||||
observers::ObserversTuple,
|
observers::{CanTrack, ObserversTuple},
|
||||||
schedulers::{HasQueueCycles, RemovableScheduler, Scheduler},
|
schedulers::{HasQueueCycles, MinimizerScheduler, RemovableScheduler, Scheduler, TestcaseScore},
|
||||||
state::{HasCorpus, HasRand, State, UsesState},
|
state::{HasCorpus, HasRand, State, UsesState},
|
||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
|
use libafl_bolts::{serdeany::SerdeAny, AsIter, HasRefCnt};
|
||||||
|
|
||||||
pub enum SupportedSchedulers<S, Q, W> {
|
pub enum SupportedSchedulers<S, Q, CS, F, M, O> {
|
||||||
Queue(Q, PhantomData<(S, Q, W)>),
|
Queue(Q, PhantomData<(S, Q, CS, F, M, O)>),
|
||||||
Weighted(W, PhantomData<(S, Q, W)>),
|
Weighted(MinimizerScheduler<CS, F, M, O>, PhantomData<(S, Q, CS, F, M, O)>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, Q, W> UsesState for SupportedSchedulers<S, Q, W>
|
impl<S, Q, CS, F, M, O> UsesState for SupportedSchedulers<S, Q, CS, F, M, O>
|
||||||
where
|
where
|
||||||
S: State + HasRand + HasCorpus + HasMetadata + HasTestcase,
|
S: State + HasRand + HasCorpus + HasMetadata + HasTestcase,
|
||||||
{
|
{
|
||||||
type State = S;
|
type State = S;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, Q, W> RemovableScheduler for SupportedSchedulers<S, Q, W>
|
impl<S, Q, CS, F, M, O> RemovableScheduler for SupportedSchedulers<S, Q, CS, F, M, O>
|
||||||
where
|
where
|
||||||
S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State,
|
S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State,
|
||||||
Q: Scheduler<State = S> + RemovableScheduler,
|
Q: Scheduler<State = S> + RemovableScheduler,
|
||||||
W: Scheduler<State = S> + RemovableScheduler,
|
CS: RemovableScheduler<State = S>,
|
||||||
|
M: for<'a> AsIter<'a, Item = usize> + SerdeAny + HasRefCnt,
|
||||||
|
O: CanTrack,
|
||||||
|
F: TestcaseScore<S>,
|
||||||
{
|
{
|
||||||
fn on_remove(
|
fn on_remove(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -52,11 +56,14 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, Q, W> Scheduler for SupportedSchedulers<S, Q, W>
|
impl<S, Q, CS, F, M, O> Scheduler for SupportedSchedulers<S, Q, CS, F, M, O>
|
||||||
where
|
where
|
||||||
S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State,
|
S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State,
|
||||||
Q: Scheduler<State = S>,
|
Q: Scheduler<State = S>,
|
||||||
W: Scheduler<State = S>,
|
CS: Scheduler<State = S>,
|
||||||
|
M: for<'a> AsIter<'a, Item = usize> + SerdeAny + HasRefCnt,
|
||||||
|
O: CanTrack,
|
||||||
|
F: TestcaseScore<S>
|
||||||
{
|
{
|
||||||
fn on_add(&mut self, state: &mut Self::State, id: CorpusId) -> Result<(), Error> {
|
fn on_add(&mut self, state: &mut Self::State, id: CorpusId) -> Result<(), Error> {
|
||||||
match self {
|
match self {
|
||||||
@ -99,16 +106,19 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, Q, W> HasQueueCycles for SupportedSchedulers<S, Q, W>
|
impl<S, Q, CS, F, M, O> HasQueueCycles for SupportedSchedulers<S, Q, CS, F, M, O>
|
||||||
where
|
where
|
||||||
S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State,
|
S: UsesInput + HasTestcase + HasMetadata + HasCorpus + HasRand + State,
|
||||||
Q: Scheduler<State = S> + HasQueueCycles,
|
Q: Scheduler<State = S> + HasQueueCycles,
|
||||||
W: Scheduler<State = S> + HasQueueCycles,
|
CS: Scheduler<State = S> + HasQueueCycles,
|
||||||
|
O: CanTrack,
|
||||||
|
M: for<'a> AsIter<'a, Item = usize> + SerdeAny + HasRefCnt,
|
||||||
|
F: TestcaseScore<S>
|
||||||
{
|
{
|
||||||
fn queue_cycles(&self) -> u64 {
|
fn queue_cycles(&self) -> u64 {
|
||||||
match self {
|
match self {
|
||||||
Self::Queue(queue, _) => queue.queue_cycles(),
|
Self::Queue(queue, _) => queue.queue_cycles(),
|
||||||
Self::Weighted(weighted, _) => weighted.queue_cycles(),
|
Self::Weighted(weighted, _) => weighted.base().queue_cycles(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user