Remove *_child variants of pre_exec/post_exec hooks#3817
Remove *_child variants of pre_exec/post_exec hooks#38170xmuon wants to merge 2 commits intoAFLplusplus:mainfrom
Conversation
addisoncrump
left a comment
There was a problem hiding this comment.
Some parts of this are wrong in ways I'm not sure how to handle, because the _child functions are all seemingly misused.
@tokatoka, I see no evidence that we have any _child functions in the whole codebase that do anything. Safe to remove this from the API? It seems to be just incorrectly used everywhere.
| 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) |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
oh yeah,will revert to just calling execute_input_with_command since the fuzzer handles observer pre/post.
| 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)?; |
There was a problem hiding this comment.
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?
| ) -> Result<ExitKind, Error> { | ||
| use wait_timeout::ChildExt; | ||
|
|
||
| self.observers_mut().pre_exec_all(state, input)?; |
There was a problem hiding this comment.
... 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.
|
Following a conversation with the other LibAFL folks, we've decided to entirely remove the |
|
oh sure, I will remove |
|
Are you sure you want to handle that? I was planning to do so myself, but if you think you've got it, go for it. |
|
I will try my best and will ask wherever needed... |
|
after the removal, |
|
hmm, i don't think the LibAFL/fuzzers/forkserver/libafl-fuzz/src/main.rs Lines 197 to 204 in b32557c and the |
Description
Removed all duplicates that I could find.(can you point out other duplicates that I missed? @addisoncrump )
After removing a duplicate implementation, build started failing because
run_targetwas no longer invoking the observers’pre_exec/post_execcallbacks, which meant things relying on those hooks (stdout/stderrcapture observers that finalize reads inpost_exec) break. So, I explicitly added the missingpre_exec_allandpost_exec_allcalls aroundexecute_input_with_command, so observers are always notified at the right time and executor behaves correctly.fix: #2445
Checklist
./scripts/precommit.shand addressed all comments