Skip to content

Commit

Permalink
remove things in calibration stage
Browse files Browse the repository at this point in the history
  • Loading branch information
tokatoka committed Jun 19, 2024
1 parent 3c4dcf6 commit ba24513
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions libafl/src/stages/calibrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};

use super::ExecutionDecision;
use crate::{
corpus::{Corpus, SchedulerTestcaseMetadata},
corpus::{Corpus, HasCurrentCorpusId, SchedulerTestcaseMetadata},
events::{Event, EventFirer, LogSeverity},
executors::{Executor, ExitKind, HasObservers},
feedbacks::{map::MapFeedbackMetadata, HasObserverHandle},
Expand Down Expand Up @@ -354,10 +354,18 @@ where
fn should_run(&mut self, state: &mut Self::State) -> Result<ExecutionDecision, Error> {
// Calibration stage disallow restarts
// If a testcase that causes crash/timeout in the queue, we need to remove it from the queue immediately.
RestartHelper::zero_else_abort(state, &self.name)

// todo
// remove this guy from corpus queue
let ret = RestartHelper::zero_else_abort(state, &self.name)?;

if ret == ExecutionDecision::Abort {
// Now if we decide to abort executions, then we should remove this testcase from the corpus
let id_to_remove = state.current_corpus_id()?;
if let Some(x) = id_to_remove {
log::info!("Moving corpus {} to the disabled corpus queue because it failed in the calibration stage", x);
let tc = state.corpus_mut().remove(x)?;
state.corpus_mut().add_disabled(tc)?;
}
}
Ok(ret)
}

fn clear_progress(&mut self, state: &mut Self::State) -> Result<(), Error> {
Expand Down

0 comments on commit ba24513

Please sign in to comment.