Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename some functions in fuzzer.rs #2355

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libafl/src/events/centralized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ where
process::id(),
event_name
);
fuzzer.execute_and_process(
fuzzer.evaluate_execution(
state,
self,
input.clone(),
Expand Down
5 changes: 2 additions & 3 deletions libafl/src/events/llmp/mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,8 @@ where
{
state.scalability_monitor_mut().testcase_with_observers += 1;
}
fuzzer.execute_and_process(
state, self, input, &observers, &exit_kind, false,
)?
fuzzer
.evaluate_execution(state, self, input, &observers, &exit_kind, false)?
} else {
#[cfg(feature = "scalability_introspection")]
{
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/events/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ where
{
state.scalability_monitor_mut().testcase_with_observers += 1;
}
fuzzer.execute_and_process(state, self, input, &observers, &exit_kind, false)?
fuzzer.evaluate_execution(state, self, input, &observers, &exit_kind, false)?
} else {
#[cfg(feature = "scalability_introspection")]
{
Expand Down
14 changes: 7 additions & 7 deletions libafl/src/fuzzer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ pub trait HasObjective: UsesState {

/// Evaluates if an input is interesting using the feedback
pub trait ExecutionProcessor<OT>: UsesState {
/// Evaluate if a set of observation channels has an interesting state
fn execute_no_process<EM>(
/// Check the outcome of the execution, find if it is worth for corpus or objectives
fn check_results<EM>(
&mut self,
state: &mut Self::State,
manager: &mut EM,
Expand All @@ -98,7 +98,7 @@ pub trait ExecutionProcessor<OT>: UsesState {
EM: EventFirer<State = Self::State>;

/// Evaluate if a set of observation channels has an interesting state
fn execute_and_process<EM>(
fn evaluate_execution<EM>(
&mut self,
state: &mut Self::State,
manager: &mut EM,
Expand Down Expand Up @@ -356,7 +356,7 @@ where
+ HasCurrentTestcase<<Self::State as UsesInput>::Input>
+ HasCurrentCorpusId,
{
fn execute_no_process<EM>(
fn check_results<EM>(
&mut self,
state: &mut Self::State,
manager: &mut EM,
Expand Down Expand Up @@ -399,7 +399,7 @@ where
Ok(res)
}

fn execute_and_process<EM>(
fn evaluate_execution<EM>(
&mut self,
state: &mut Self::State,
manager: &mut EM,
Expand All @@ -411,7 +411,7 @@ where
where
EM: EventFirer<State = Self::State>,
{
let exec_res = self.execute_no_process(state, manager, &input, observers, exit_kind)?;
let exec_res = self.check_results(state, manager, &input, observers, exit_kind)?;
let corpus_id = self.process_execution(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this guy be evaluate_execution?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evaluate_execution is already used. actually it's wrapping this

evaluate_execution have two wrapped functions
check_results: to see if the testcase is obj or corpus and
process_execution: append metadatas

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming is hard

state,
manager,
Expand Down Expand Up @@ -548,7 +548,7 @@ where

self.scheduler.on_evaluation(state, &input, &*observers)?;

self.execute_and_process(state, manager, input, &*observers, &exit_kind, send_events)
self.evaluate_execution(state, manager, input, &*observers, &exit_kind, send_events)
}
}

Expand Down
2 changes: 1 addition & 1 deletion libafl/src/stages/push/mutational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ where
) -> Result<(), Error> {
// todo: is_interesting, etc.

fuzzer.execute_and_process(state, event_mgr, last_input, observers, &exit_kind, true)?;
fuzzer.evaluate_execution(state, event_mgr, last_input, observers, &exit_kind, true)?;

start_timer!(state);
self.mutator.post_exec(state, self.current_corpus_id)?;
Expand Down
2 changes: 1 addition & 1 deletion libafl/src/stages/tmin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ where
// TODO replace if process_execution adds a return value for solution index
let solution_count = state.solutions().count();
let corpus_count = state.corpus().count();
let (_, corpus_id) = fuzzer.execute_and_process(
let (_, corpus_id) = fuzzer.evaluate_execution(
state,
manager,
input.clone(),
Expand Down
Loading