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

introduce multicore load initial corpus #1905

Merged
merged 12 commits into from
Mar 8, 2024
Merged

Conversation

R9295
Copy link
Collaborator

@R9295 R9295 commented Mar 4, 2024

implements and closes #1746
I ended up implementing a multicore version unlike what I wrote in the issue. It traverses the corpus entries twice (at most), which is inefficient but is probably the simplest implementation I could think of.

to test:

cd fuzzers/libfuzzer_libpng_norestart
RUST_LOG="debug" LIBAFL_DEBUG_OUTPUT=1 ./fuzzer_libpng --cores 1,2 --input seeds > debug
cat debug

libafl/src/state/mod.rs Outdated Show resolved Hide resolved
@domenukk
Copy link
Member

domenukk commented Mar 4, 2024

Thank you! Looks like very good already! However, we need to consider restarts during testcase evaluation time. You probably want to store all inputs to be processed in a Vec in the state for the current core, and if the vec already exists (after restart) skip over this initial loading, and continue processing the vec (?)

@R9295
Copy link
Collaborator Author

R9295 commented Mar 5, 2024

@domenukk Thanks, I will update it.
A question though: why is it built this way? If it crashes or has a timeout, wouldn't that be achieving a "solution"

@R9295 R9295 requested a review from domenukk March 5, 2024 04:35
@domenukk
Copy link
Member

domenukk commented Mar 5, 2024

It follows AFL++'s (optional) concept of ignoring timeouts and crashes in the initial seed corpus, since that stuff is already stored.
We could consider optionally adding it to the solutions of course, it might be useful for someuse cases, who knows?

@domenukk
Copy link
Member

domenukk commented Mar 5, 2024

Run cd libafl && cargo test --no-default-features
   Compiling libafl_bolts v0.11.2 (/home/runner/work/LibAFL/LibAFL/libafl_bolts)
   Compiling libafl v0.11.2 (/home/runner/work/LibAFL/LibAFL/libafl)
error[E0560]: struct `StdState<I, C, R, SC>` has no field named `multicore_inputs_processed`
    --> libafl/src/state/mod.rs:10[8](https://github.com/AFLplusplus/LibAFL/actions/runs/8157117940/job/22296046890?pr=1905#step:14:9)3:13
     |
[10](https://github.com/AFLplusplus/LibAFL/actions/runs/8157117940/job/22296046890?pr=1905#step:14:11)83 |             multicore_inputs_processed: None,
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^ `StdState<I, C, R, SC>` does not have this field
     |
     = note: all struct fields are already assigned

Looks like no_std is broken now

@R9295
Copy link
Collaborator Author

R9295 commented Mar 6, 2024

@domenukk should be good now

@domenukk
Copy link
Member

domenukk commented Mar 6, 2024

error: item in documentation is missing backticks
   --> libafl/src/state/mod.rs:332:27
    |
332 |     /// relevant only for load_multicore_inputs

Last tiny things in docs, else looks good to go! :)

@domenukk
Copy link
Member

domenukk commented Mar 6, 2024

One last cargo +nightly fmt in the example fuzzer you changed 😬

@R9295
Copy link
Collaborator Author

R9295 commented Mar 7, 2024

@domenukk not sure why one of the runs is failing..

@tokatoka
Copy link
Member

tokatoka commented Mar 7, 2024

the error is due to my previous changes..

204 |         let mut executor = InProcessExecutor::batched_timeouts(
    |                                               ^^^^^^^^^^^^^^^^
    |                                               |
    |                                               function or associated item not found in `GenericInProcessExecutor<_, &mut _, (), _, _>`
    |                                               help: there is an associated function with a similar name: `batched_timeout`

can you change this to batched_timeout as suggested?

@tokatoka
Copy link
Member

tokatoka commented Mar 7, 2024

i'll fix it

@domenukk domenukk merged commit d6fe67c into AFLplusplus:main Mar 8, 2024
26 checks passed
@domenukk
Copy link
Member

domenukk commented Mar 8, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add multicore load_initial_inputs (for Launcher, etc.)
4 participants