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

Adds custom executor, major refactor of fuzzer.rs #49

Merged
merged 25 commits into from
Jan 22, 2025
Merged

Conversation

grebnetiew
Copy link
Contributor

This adds the SequenceExecutor, which takes care of executing inputs.
This has some advantages over using the LibAFL executors:

  • Harness is no longer a lambda which captures half of the locals in fuzz(). Instead it's a method of the executor, and the HTTP client, authentication and cookie machinery as well as the stats tracking are now fields of the executor. This improves readability and ease of later refactors.
  • When updating the stats in post_exec, we now get the event manager as a function argument from the fuzzer. We used to rely on some pointer magic from inprocess_get_event_manager, which is kind of necessary when binary fuzzing (we never did that) and working against the LibAFL executor design instead of with it (we did do that unwittingly).

Closes #12

Copy link

github-actions bot commented Dec 4, 2024

Sigrid maintainability feedback

⚠️ Your code did not improve maintainability towards your objective of 4.0 stars

Show details

Sigrid compared your code against the baseline of 2025-01-21.

👍 What went well?

You fixed or improved 1 refactoring candidates.

Risk System property Location
🔴 Unit Size
(Improved)
WuppieFuzz/src/fuzzer.rs
fuzz()

👎 What could be better?

Unfortunately, 12 refactoring candidates were introduced or got worse.

Risk System property Location
🔴 Duplication
(Introduced)
WuppieFuzz/src/reporting/mod.rs (lines 34-39)
WuppieFuzz/src/reporting/mod.rs (lines 73-78)
WuppieFuzz/src/reporting/sqlite.rs (lines 175-180)
🔴 Duplication
(Introduced)
WuppieFuzz/src/executor.rs (lines 32-38)
WuppieFuzz/src/reproducer.rs (lines 13-19)
🔴 Duplication
(Introduced)
WuppieFuzz/src/reporting/mod.rs (lines 19-24)
WuppieFuzz/src/reporting/mod.rs (lines 48-53)
🟠 Unit Size
(Introduced)
WuppieFuzz/src/executor.rs
post_exec(FuzzerState,OpenApiInput,EM)
🟠 Unit Interfacing
(Introduced)
WuppieFuzz/src/reporting/mod.rs
get_current_test_case_file_name(OpenApiFuzzerState,any,any,rands,any,any)
🟡 Unit Size
(Introduced)
WuppieFuzz/src/reporting/sqlite.rs
Reporting.report_request(OpenApiRequest,CurlRequest,Oafs,usize)
🟡 Unit Complexity
(Introduced)
WuppieFuzz/src/fuzzer.rs
fuzz()
🟡 Unit Complexity
(Introduced)
WuppieFuzz/src/executor.rs
post_exec(FuzzerState,OpenApiInput,EM)
⚫️ + 4 more

📚 Remaining technical debt

4 refactoring candidates didn't get better or worse, but are still present in the code you touched.

View this system in Sigrid** to explore your technical debt

⭐️ Sigrid ratings

System property System on 2025-01-21 Before changes New/changed code
Volume 5.4 N/A N/A
Duplication 4.1 4.4 4.2
Unit Size 2.1 1.2 1.7
Unit Complexity 2.9 5.5 1.6
Unit Interfacing 2.0 3.5 0.9
Module Coupling 3.3 5.5 5.5
Component Independence 5.4 N/A N/A
Component Entanglement N/A N/A N/A
Maintainability 3.6 4.2 3.0

💬 Did you find this feedback helpful?

We would like to know your thoughts to make Sigrid better.
Your username will remain confidential throughout the process.


View this system in Sigrid

@grebnetiew
Copy link
Contributor Author

grebnetiew commented Dec 5, 2024

  • Finish moving the stop check to the executor
    • Check in pre-exec if stop_request was made, and stop in that case
    • maybe also move the entire construction of manual_interrupt

@ThomasTNO
Copy link
Contributor

ThomasTNO commented Dec 6, 2024

  • Ensure --report works again
thread 'main' panicked at src/reporting/mod.rs:86:6:
State is gone??

@ThomasTNO
Copy link
Contributor

This should also close #30

@grebnetiew grebnetiew requested a review from ThomasTNO January 16, 2025 14:21
@ThomasTNO
Copy link
Contributor

I still need to review this. We should add a changelog, But I suggest to first release v1.1.2. Next I will make a release including this for v1.2.0

Copy link
Contributor

@ThomasTNO ThomasTNO left a comment

Choose a reason for hiding this comment

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

@grebnetiew just a couple of minor remarks. Looks great, this is a major improvement!

src/executor.rs Show resolved Hide resolved
src/executor.rs Outdated Show resolved Hide resolved
src/fuzzer.rs Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@ThomasTNO
Copy link
Contributor

In the meantime we migrated to LibAFL 0.15.0 in #65. @grebnetiew can you ensure that the required changes are ported to this PR as well?

@grebnetiew
Copy link
Contributor Author

In the meantime we migrated to LibAFL 0.15.0 in #65. @grebnetiew can you ensure that the required changes are ported to this PR as well?

Done. Let's merge soon - keeping two branches up-to-date with dependencies is kind of a waste of time imo ;)

@ThomasTNO
Copy link
Contributor

In the meantime we migrated to LibAFL 0.15.0 in #65. @grebnetiew can you ensure that the required changes are ported to this PR as well?

Done. Let's merge soon - keeping two branches up-to-date with dependencies is kind of a waste of time imo ;)

I agree. I am fine with the merge

@grebnetiew grebnetiew merged commit e81e728 into main Jan 22, 2025
8 of 9 checks passed
@grebnetiew grebnetiew deleted the executor branch January 22, 2025 12:34
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.

Implement custom executor
2 participants