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

Update fuzzing loop and fix optimization mode #548

Merged
merged 13 commits into from
Feb 1, 2025

Conversation

anishnaik
Copy link
Collaborator

@anishnaik anishnaik commented Jan 31, 2025

Closes #498

The primary purpose for this PR is to be able to solve the problem disclosed in #498 which highlights that shrinking in optimization mode is insanely inefficient. The way the current fuzzing loop is structured, each time a new maximum value was identified, the optimization testing provider was forced to request a shrink request. There was no way for the provider to request a "one-shot" shrink request at the end of the campaign.

Thus, we had to make a few core changes. First, we needed to capture when the fuzzing campaign is about to end but there is at least still one fuzzer worker alive that can handle the final shrink requests from the optimization provider. So, we introduced a new fuzzer worker event that the optimization provider subscribes to which allows the provider to request shrink requests right before the fuzzer is torn down.

The problem with the new solution is that we still need to allow the user to ctrl+c if they don't want the shrinking to complete. So, we had to create two fuzzer contexts: the main context and the emergency context. The main context is cancelled when a timeout is hit or when the test limit is hit. The emergency one is triggered by a SIGINT/SIGKILL or if an error occurs in the core fuzzing loop.

To support all of this we had to update the core fuzzing loop as well to handle the two different contexts and the ability to handle shrink requests before shutting down.

@anishnaik anishnaik requested a review from Xenomega as a code owner January 31, 2025 21:10
@anishnaik anishnaik changed the title WIP: Update core fuzzing loop Update fuzzing loop and fix optimization mode Jan 31, 2025
@anishnaik anishnaik merged commit 42a22ca into master Feb 1, 2025
12 checks passed
@anishnaik anishnaik deleted the dev/update-fuzzing-loop branch February 1, 2025 01:35
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.

Inefficient shrinking in optimization mode
1 participant