Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are following changes in this PR:
Forkserver logics are refactored to fit in Refactor to new forkserver LibAFL#3183 (changes in
src/forkserver.rs
andsrc/target.rs
), thus the dependency inCargo.toml
has been modified to the upstream LibAFL. (And after that PR got rolled in LibAFL's released versions, we can change the git dependency into crates.io dependency)Legacy stage is removed.
In my understanding, the persistent loop is not a "stage". It is just part of a target harness.
Callbacks are unioned into a
UnicornAflExecutorHook
.This removes a lot of ugly trait constraints across the crate implementation, and is more like LibAFL's style. Moreover, the C-side user API perfected remained consistent.
Forkserver-level TB cache is added.
The logic is one-to-one translation from the previous UnicornAFL's C++ code.
Several documentation are added.
Other LibAFL-compatible changes
In my understanding, there are three ways to use UnicornAFL now:
Use AFL++'s
afl-fuzz
This will use the persistent loop in
src/harness.rs
Use LibAFL's
ForkserverExecutor
In fact, this is essentially the same as AFL++'s
afl-fuzz
. As a result, this will also use the persistent loop.Directly use
UnicornAflExecutor
with other LibAFL primitivesThe previous two approaches are designed to be compatible with AFL++, and this approach is more pure-LibAFL.
This is only related to the last few lines in
src/executors.rs
, which is the implementation ofExecutor
trait forUnicornAflExecutor
.After these thoughts, some minor modifications are conducted to make it more clear and consistent:
execute_internal
method forUnicornAflExecutor
, which can be invoked byExecutor::run_target
or persistent loop insrc/harness.c
UnsafeSliceInput
anymore, since we can directly use a slice to feed.UnicornAflExecutor
are modified to be correctly composable with LibAFL's otherObserver
s.