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

Feature: Make executors and feedbacks easier to use outside of the fuzzing loop #2511

Conversation

Lukas-Dresel
Copy link
Contributor

@Lukas-Dresel Lukas-Dresel commented Sep 6, 2024

It would be nice to be able to use LibAFL components more easily outside of LibAFL's fuzzer harnessing (by which I mean the plug-and-play fuzzing loop) to allow for more reuse.
For example, I found myself ripping my hair out over trying to just run the forkserver with an observer to simply collect, aggregate and plot coverage. To do so, I had to provide types for fuzzers, feedbacks, schedulers, etc. even though none of those things were relevant for my use-case.

I ended up making changes like the ones in this PR in my own fork and it made it quite a bit nicer to use, now you can reuse some of the components and are only required to satisfy the directly needed type constraints for these components.

@Lukas-Dresel Lukas-Dresel changed the title Feature: Make executors and feedbacks more easy to use without the full integration Feature: Make executors and feedbacks more easier to use outside of the normal fuzzing loop Sep 6, 2024
@Lukas-Dresel Lukas-Dresel changed the title Feature: Make executors and feedbacks more easier to use outside of the normal fuzzing loop Feature: Make executors and feedbacks more easier to use outside of the fuzzing loop Sep 6, 2024
@Lukas-Dresel Lukas-Dresel changed the title Feature: Make executors and feedbacks more easier to use outside of the fuzzing loop Feature: Make executors and feedbacks easier to use outside of the fuzzing loop Sep 6, 2024
@domenukk
Copy link
Member

domenukk commented Sep 8, 2024

@addisoncrump can you take a look? It might interfere with #2438 somewhat (?)

@domenukk
Copy link
Member

domenukk commented Sep 8, 2024

It would be nice to be able to use LibAFL components more easily outside of LibAFL's fuzzer harnessing (by which I mean the plug-and-play fuzzing loop) to allow for more reuse. For example, I found myself ripping my hair out over trying to just run the forkserver with an observer to simply collect, aggregate and plot coverage. To do so, I had to provide types for fuzzers, feedbacks, schedulers, etc. even though none of those things were relevant for my use-case.

ideally the normal run_target would already be reusable / have minimal generic bounds/ have sensible Nop Variants for easy use.
But it might be a goal that's harder to achieve :D

@addisoncrump
Copy link
Collaborator

Sorry for the delay -- lots of IRL stuff right now. I will look at this tomorrow.

@domenukk
Copy link
Member

Sorry for the delay, I think we can merge this.

@tokatoka
Copy link
Member

wait, i'll check this when i refactor (or before) executor.
don't merge now

@Lukas-Dresel
Copy link
Contributor Author

Lukas-Dresel commented Oct 12, 2024

Just checking in, what's the status of this? Is the idea still to merge this or replace it by other changes?

testcase: &mut Testcase<S::Input>,
) -> Result<(), Error>
where
S: State + UsesInput,
Copy link
Member

Choose a reason for hiding this comment

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

Can you try to not use UsesInput here?
You can specify
S: HasCorpus and make the input to be <S::Corpus as Corpus>::Input

&mut self,
state: &mut S,
_manager: &mut EM,
_input: &<S as UsesInput>::Input,
Copy link
Member

Choose a reason for hiding this comment

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

here avoid UsesInput too

testcase: &mut Testcase<S::Input>,
) -> Result<(), Error>
where
S: UsesInput + HasCorpus<Input = NautilusInput> + HasMetadata,
Copy link
Member

Choose a reason for hiding this comment

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

here too

@tokatoka
Copy link
Member

Sorry for the late review.
Overall good. Just one thing, we're trying to remove UsesInput generics recently. Can you try to remove the uses of these trait as much as possible.

testcase: &mut Testcase<S::Input>,
) where
OT: ObserversTuple<S>,
S: UsesInput,
Copy link
Member

Choose a reason for hiding this comment

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

here too


impl<S, T> Feedback<S> for ListFeedback<T>
where
S: State + HasNamedMetadata,
Copy link
Member

Choose a reason for hiding this comment

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

do you need S: State?

manager: &mut EM,
input: &<S as UsesInput>::Input,
_manager: &mut EM,
_input: &<S as UsesInput>::Input,
Copy link
Member

Choose a reason for hiding this comment

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

here too.

@tokatoka
Copy link
Member

tell me if you want me to merge from main and resolve conflicts

@domenukk
Copy link
Member

@tokatoka if you find the time let's just finish/merge this for 0.14, lukas has done his part I think :)

@domenukk
Copy link
Member

Finishing this in #2637, thanks for your help @Lukas-Dresel ! :)

@domenukk domenukk closed this Oct 29, 2024
domenukk added a commit that referenced this pull request Oct 29, 2024
…zzing loop (extends #2511) (#2637)

* feat(libafl_core): make executors and feedbacks more cleanly usable outside of LibAFLs Fuzzer loop

* cargo +nightly fmt

* updated type constraints

* reformatted and final type constraint fixes

* made unicode extraction stage useful separately

* fix libafl_cc error message

* fix state type constraint to be constrained on the method

* removed unnecessary observer constraint

* renamed unused variables

* fix unnecessary error wrapping in helper functions

* converted unicode conversion stage into associated function and fixed nautilus changes

* more update

* Remove extra I

* more fmt

* bounds?

* less bounds

* more less bounds

* different trait bounds again

* more less generics

* fix unicode

* fix list

* remove unneeded bound

---------

Co-authored-by: Lukas Dresel <[email protected]>
Co-authored-by: Toka <[email protected]>
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.

4 participants