Update exec counts in objective (#1945)
* fix * fix * update exec count
This commit is contained in:
parent
5cc0180835
commit
e30ff57456
@ -303,10 +303,15 @@ where
|
|||||||
// Correctly handled the event
|
// Correctly handled the event
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::Objective { objective_size } => {
|
Event::Objective {
|
||||||
|
objective_size,
|
||||||
|
executions,
|
||||||
|
time,
|
||||||
|
} => {
|
||||||
monitor.client_stats_insert(client_id);
|
monitor.client_stats_insert(client_id);
|
||||||
let client = monitor.client_stats_mut_for(client_id);
|
let client = monitor.client_stats_mut_for(client_id);
|
||||||
client.update_objective_size(*objective_size as u64);
|
client.update_objective_size(*objective_size as u64);
|
||||||
|
client.update_executions(*executions, *time);
|
||||||
monitor.display(event.name(), client_id);
|
monitor.display(event.name(), client_id);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
|
@ -338,6 +338,10 @@ where
|
|||||||
Objective {
|
Objective {
|
||||||
/// Objective corpus size
|
/// Objective corpus size
|
||||||
objective_size: usize,
|
objective_size: usize,
|
||||||
|
/// The total number of executions when this objective is found
|
||||||
|
executions: u64,
|
||||||
|
/// The time when this event was created
|
||||||
|
time: Duration,
|
||||||
},
|
},
|
||||||
/// Write a new log
|
/// Write a new log
|
||||||
Log {
|
Log {
|
||||||
|
@ -262,11 +262,18 @@ where
|
|||||||
monitor.display(event.name(), ClientId(0));
|
monitor.display(event.name(), ClientId(0));
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::Objective { objective_size } => {
|
Event::Objective {
|
||||||
|
objective_size,
|
||||||
|
executions,
|
||||||
|
time,
|
||||||
|
} => {
|
||||||
monitor.client_stats_insert(ClientId(0));
|
monitor.client_stats_insert(ClientId(0));
|
||||||
monitor
|
monitor
|
||||||
.client_stats_mut_for(ClientId(0))
|
.client_stats_mut_for(ClientId(0))
|
||||||
.update_objective_size(*objective_size as u64);
|
.update_objective_size(*objective_size as u64);
|
||||||
|
monitor
|
||||||
|
.client_stats_mut_for(ClientId(0))
|
||||||
|
.update_executions(*executions, *time);
|
||||||
monitor.display(event.name(), ClientId(0));
|
monitor.display(event.name(), ClientId(0));
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
|
@ -386,10 +386,15 @@ where
|
|||||||
// Correctly handled the event
|
// Correctly handled the event
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::Objective { objective_size } => {
|
Event::Objective {
|
||||||
|
objective_size,
|
||||||
|
executions,
|
||||||
|
time,
|
||||||
|
} => {
|
||||||
monitor.client_stats_insert(client_id);
|
monitor.client_stats_insert(client_id);
|
||||||
let client = monitor.client_stats_mut_for(client_id);
|
let client = monitor.client_stats_mut_for(client_id);
|
||||||
client.update_objective_size(*objective_size as u64);
|
client.update_objective_size(*objective_size as u64);
|
||||||
|
client.update_executions(*executions, *time);
|
||||||
monitor.display(event.name(), client_id);
|
monitor.display(event.name(), client_id);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,8 @@ pub fn run_observers_and_save_state<E, EM, OF, Z>(
|
|||||||
.expect("In run_observers_and_save_state objective failure.");
|
.expect("In run_observers_and_save_state objective failure.");
|
||||||
|
|
||||||
if interesting {
|
if interesting {
|
||||||
let mut new_testcase = Testcase::with_executions(input.clone(), *state.executions());
|
let executions = *state.executions();
|
||||||
|
let mut new_testcase = Testcase::with_executions(input.clone(), executions);
|
||||||
new_testcase.add_metadata(exitkind);
|
new_testcase.add_metadata(exitkind);
|
||||||
new_testcase.set_parent_id_optional(*state.corpus().current());
|
new_testcase.set_parent_id_optional(*state.corpus().current());
|
||||||
fuzzer
|
fuzzer
|
||||||
@ -466,6 +467,8 @@ pub fn run_observers_and_save_state<E, EM, OF, Z>(
|
|||||||
state,
|
state,
|
||||||
Event::Objective {
|
Event::Objective {
|
||||||
objective_size: state.solutions().count(),
|
objective_size: state.solutions().count(),
|
||||||
|
executions,
|
||||||
|
time: libafl_bolts::current_time(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.expect("Could not save state in run_observers_and_save_state");
|
.expect("Could not save state in run_observers_and_save_state");
|
||||||
|
@ -415,8 +415,9 @@ where
|
|||||||
// Not interesting
|
// Not interesting
|
||||||
self.feedback_mut().discard_metadata(state, &input)?;
|
self.feedback_mut().discard_metadata(state, &input)?;
|
||||||
|
|
||||||
|
let executions = *state.executions();
|
||||||
// The input is a solution, add it to the respective corpus
|
// The input is a solution, add it to the respective corpus
|
||||||
let mut testcase = Testcase::with_executions(input, *state.executions());
|
let mut testcase = Testcase::with_executions(input, executions);
|
||||||
testcase.set_parent_id_optional(*state.corpus().current());
|
testcase.set_parent_id_optional(*state.corpus().current());
|
||||||
self.objective_mut()
|
self.objective_mut()
|
||||||
.append_metadata(state, manager, observers, &mut testcase)?;
|
.append_metadata(state, manager, observers, &mut testcase)?;
|
||||||
@ -427,6 +428,8 @@ where
|
|||||||
state,
|
state,
|
||||||
Event::Objective {
|
Event::Objective {
|
||||||
objective_size: state.solutions().count(),
|
objective_size: state.solutions().count(),
|
||||||
|
executions,
|
||||||
|
time: current_time(),
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
@ -520,10 +523,13 @@ where
|
|||||||
.append_metadata(state, manager, observers, &mut testcase)?;
|
.append_metadata(state, manager, observers, &mut testcase)?;
|
||||||
let idx = state.solutions_mut().add(testcase)?;
|
let idx = state.solutions_mut().add(testcase)?;
|
||||||
|
|
||||||
|
let executions = *state.executions();
|
||||||
manager.fire(
|
manager.fire(
|
||||||
state,
|
state,
|
||||||
Event::Objective {
|
Event::Objective {
|
||||||
objective_size: state.solutions().count(),
|
objective_size: state.solutions().count(),
|
||||||
|
executions,
|
||||||
|
time: current_time(),
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
return Ok(idx);
|
return Ok(idx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user