Skip to content

Keep fuzz inputs for older branches#274

Merged
maflcko merged 1 commit into
bitcoin-core:mainfrom
ekzyis:keep-fuzz-inputs-for-older-branches
Apr 14, 2026
Merged

Keep fuzz inputs for older branches#274
maflcko merged 1 commit into
bitcoin-core:mainfrom
ekzyis:keep-fuzz-inputs-for-older-branches

Conversation

@ekzyis
Copy link
Copy Markdown
Contributor

@ekzyis ekzyis commented Apr 12, 2026

close #265

see comment below for more information

Comment thread delete-nonreduced-fuzz-inputs/src/main.rs
@ekzyis ekzyis marked this pull request as draft April 12, 2026 10:52
@ekzyis ekzyis force-pushed the keep-fuzz-inputs-for-older-branches branch 4 times, most recently from f131dae to 4babc48 Compare April 12, 2026 22:57
@ekzyis
Copy link
Copy Markdown
Contributor Author

ekzyis commented Apr 12, 2026

4babc48 looks good to me now. Updated PR description.

I ran this against a test fuzz corpora in ekzyis@a4ef010 (a different branch) to speed things up. Took 30 minutes with --extra-ref v30.2 --extra-ref v29.3. To do the same, run this in the VM:

$ git clone --depth=1 --branch=test-keep-fuzz-inputs-for-older-branches https://github.com/ekzyis/qa-assets
$ cp -r qa-assets/delete-nonreduced-fuzz-inputs .
$ cd delete-nonreduced-fuzz-inputs
$ sudo cargo run -- --extra-ref v30.2 --extra-ref v29.3

I had to allow empty commits because fuzzing another ref might not lead to any new fuzz inputs.

@ekzyis ekzyis marked this pull request as ready for review April 12, 2026 23:11
Copy link
Copy Markdown
Contributor

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

lgtm, just some nits

Comment thread delete-nonreduced-fuzz-inputs/src/main.rs Outdated
Comment thread delete-nonreduced-fuzz-inputs/src/main.rs Outdated
Comment thread delete-nonreduced-fuzz-inputs/src/main.rs
@ekzyis ekzyis force-pushed the keep-fuzz-inputs-for-older-branches branch from 13a8c51 to 11d2d33 Compare April 13, 2026 12:45
@ekzyis
Copy link
Copy Markdown
Contributor Author

ekzyis commented Apr 13, 2026

Thanks for the review! I didn't squash the commits yet. I thought it would make the next review easier.

I'm currently debugging why I can't use fs::remove_dir, see #274 (comment).

@ekzyis ekzyis force-pushed the keep-fuzz-inputs-for-older-branches branch from 11d2d33 to 4373c77 Compare April 13, 2026 17:33
@ekzyis
Copy link
Copy Markdown
Contributor Author

ekzyis commented Apr 13, 2026

Squashed all commits into 4373c77.

Btw, I didn't make sure that libFuzzer will only add fuzz targets to the output directory, and not delete the ones in the output directory that don't increase coverage for the fuzzed binary. I only looked at the documentation for -merge, and it doesn't mention it would:

You may use the same flag to add more interesting items to an existing corpus. Only the inputs that trigger new coverage will be added to the first corpus.

For -set_cover_merge, which is what we're using, I only found this comment in the source code:

// Merges all corpora into the first corpus. A file is added into
// the first corpus only if it adds new features. Unlike `Merger::Merge`,
// this implementation calculates an approximation of the minimum set
// of corpora files, that cover all known features (set cover problem).
// Generally, this means that files with more features are preferred for
// merge into the first corpus. When two files have the same number of
// features, the smaller one is preferred.
size_t Merger::SetCoverMerge(const std::set<uint32_t> &InitialFeatures,

for name in names {
let from = dir.join(&name);
let to = parent.join(&name);
fs::rename(&from, &to).map_err(|e| format!("fs::rename failed: {}", e.to_string()))?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

heh, I guess there could be a check to see if the file to exists, and then delete from. Otherwise, keep the move. This would allow to use remove_dir, but not important. Either way is fine.

@maflcko maflcko merged commit 7a5dbb2 into bitcoin-core:main Apr 14, 2026
4 checks passed
@ekzyis ekzyis deleted the keep-fuzz-inputs-for-older-branches branch April 14, 2026 21:28
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.

delete_nonreduced_fuzz_inputs.sh: Use older branches as well?

2 participants