Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 5 additions & 6 deletions crates/libafl/src/executors/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ where
) -> Result<ExitKind, Error> {
use wait_timeout::ChildExt;

self.observers_mut().pre_exec_all(state, input)?;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

... was this ever correct? I presume this is meant to be pre_exec_child_all, but has the same problem as the other region I highlighted.

*state.executions_mut() += 1;
let mut child = self
.configurator
Expand Down Expand Up @@ -427,8 +426,6 @@ where
self.observers_mut().index_mut(&stdout_handle).observe(buf);
}

self.observers_mut()
.post_exec_child_all(state, input, &exit_kind)?;
Ok(exit_kind)
}
}
Expand All @@ -447,7 +444,11 @@ where
_mgr: &mut EM,
input: &I,
) -> Result<ExitKind, Error> {
self.execute_input_with_command(fuzzer, state, input)
self.observers_mut().pre_exec_all(state, input)?;
let exit_kind = self.execute_input_with_command(fuzzer, state, input)?;
self.observers_mut()
.post_exec_all(state, input, &exit_kind)?;
Ok(exit_kind)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change is not correct; the fuzzer is responsible for invoking pre_ and post_exec on observers. This should be pre_ and post_exec_child, but confusingly, these would not be executed in a child process anyways...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh yeah,will revert to just calling execute_input_with_command since the fuzzer handles observer pre/post.

}
}

Expand Down Expand Up @@ -519,7 +520,6 @@ where
)));
}

self.observers.pre_exec_child_all(state, input)?;
if *state.executions() == 1 {
self.hooks.init_all(state);
}
Expand All @@ -546,7 +546,6 @@ where
};

self.hooks.post_exec_all(state, input);
self.observers.post_exec_child_all(state, input, &res)?;
Ok(res)
}
}
Expand Down
3 changes: 0 additions & 3 deletions crates/libafl/src/executors/forkserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1534,10 +1534,7 @@ where
input: &I,
) -> Result<ExitKind, Error> {
let bytes = fuzzer.convert_to_target_bytes(state, input);
self.observers_mut().pre_exec_child_all(state, input)?;
let exit = self.execute_input(state, bytes.as_slice())?;
self.observers_mut()
.post_exec_child_all(state, input, &exit)?;
Comment on lines -1537 to -1540
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change is also not correct; pre_ and post_exec_child is to be executed by the child. However, the original code also appears to be wrong because this code gets executed in the parent. @domenukk / @tokatoka / @andreafioraldi, can you give indication here as to the intended behaviour?

Ok(exit)
}
}
Expand Down
Loading