-
Notifications
You must be signed in to change notification settings - Fork 38.8k
tests: Add fuzzing harnesses for CAutoFile, CBufferedFile, LoadExternalBlockFile and other FILE* consumers #19143
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
5eda0bd to
7282135
Compare
7282135 to
36bf1d0
Compare
36bf1d0 to
27bef8c
Compare
Crypt-iQ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 27bef8c
27bef8c to
36328c3
Compare
Crypt-iQ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combined fuzzing coverage for only the fuzzers in this branch: https://crypt-iq.github.io/pr19143_cov/src/
Each fuzzer was run for about 24 hours. I used a variation of libFuzzer and AFL.
There seems to be some missing coverage in CBlockPolicyEstimator::Write & CBlockPolicyEstimator::Read. That could probably be fixed by better seeds. There's also missing coverage in LoadExternalBlockFile, and this can also be fixed by better seeds. I don't know the format of the external block files (I copy pasted the magic bytes from MessageStart() as seeds but no luck). This was the only slow fuzzing harness with ~5 execs/s.
f4f0a0c to
74a31f2
Compare
Wow, that's some thorough testing! Thanks a lot!
I think the perceived lack of coverage is simply due to To speed things up I've now added also a dedicated fuzzer for This dedicated fuzzer is running at >1000 exec/s compared to <50 exec/s for the non-dedicated one.
libFuzzer from LLVM 10 is able to reach past the magic bytes check within a few seconds. Perhaps you were using an old version of libFuzzer when running the |
46ce3bf to
bb87114
Compare
Crypt-iQ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With clang-10 I can pass the magic bytes check (I guess it uses coverage in memcmp to solve for it?). Currently running the new policy_estimator_io fuzzer as well.
…zedDataProvider using fopencookie
…e to FuzzedDataProvider
…m(…)/ReadFromStream(…)
…GetVersion} (stream.h)
bb87114 to
ad6c348
Compare
|
Can confirm that the new |
|
Tested ACK ad6c348 |
…feredFile, LoadExternalBlockFile and other FILE* consumers ad6c348 tests: Add fuzzing harness for CBlockPolicyEstimator::{Read,Write} (policy/fees.h) (practicalswift) 614e080 tests: Add fuzzing harness for CBufferedFile::{SetPos,GetPos,GetType,GetVersion} (stream.h) (practicalswift) 7bcc71e tests: Add fuzzing harness for LoadExternalBlockFile(...) (validation.h) (practicalswift) 9823376 tests: Add fuzzing harness for CBufferedFile (streams.h) (practicalswift) f3aa659 tests: Add fuzzing harness for CAutoFile (streams.h) (practicalswift) e507c07 tests: Add serialization/deserialization fuzzing helpers WriteToStream(…)/ReadFromStream(…) (practicalswift) e48094a tests: Add FuzzedAutoFileProvider which provides a CAutoFile interface to FuzzedDataProvider (practicalswift) 9dbcd68 tests: Add FuzzedFileProvider which provides a FILE* interface to FuzzedDataProvider using fopencookie (practicalswift) Pull request description: Add fuzzing harnesses for `CAutoFile`, `CBufferedFile`, `LoadExternalBlockFile` and other `FILE*` consumers: * Add `FuzzedFileProvider` which provides a `FILE*` interface to `FuzzedDataProvider` using `fopencookie` * Add `FuzzedAutoFileProvider` which provides a `CAutoFile` interface to `FuzzedDataProvider` * Add serialization/deserialization fuzzing helpers `WriteToStream(…)`/`ReadFromStream(…)` * Add fuzzing harness for `CAutoFile` (`streams.h`) * Add fuzzing harness for `CBufferedFile` (`streams.h`) * Add fuzzing harness for `LoadExternalBlockFile(...)` (`validation.h`) * Add fuzzing harness for `CBlockPolicyEstimator::Read` and `CBlockPolicyEstimator::Write` (`policy/fees.h`) See [`doc/fuzzing.md`](https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md) for information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the [Bitcoin Core fuzzing corpus repo](https://github.com/bitcoin-core/qa-assets). Happy fuzzing :) ACKs for top commit: Crypt-iQ: Tested ACK ad6c348 Tree-SHA512: a38e142608218496796a527d7e59b74e30279a2815450408b7c27a76ed600cebc6b88491e831665a0639671e2d212453fcdca558500bbadbeb32b267751f8f72
…alBlockFile and other FILE* consumers Summary: Backport of core [[bitcoin/bitcoin#19143 | PR19143]]. Depends on D9131. The last commit (bitcoin/bitcoin@ad6c348) has been skipped since we don't have the policy estimator like core. Test Plan: ninja bitcoin-fuzzers ./test/fuzz/test_runner.py <path_to_corpus> Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D9132
…File, LoadExternalBlockFile and other FILE* consumers
backport: bitcoin#18867, bitcoin#19247, bitcoin#19222, bitcoin#18363, bitcoin#18190, bitcoin#18393, partial bitcoin#18047, bitcoin#18314, bitcoin#19143 (fuzzing harness backports: part 3)
Add fuzzing harnesses for
CAutoFile,CBufferedFile,LoadExternalBlockFileand otherFILE*consumers:FuzzedFileProviderwhich provides aFILE*interface toFuzzedDataProviderusingfopencookieFuzzedAutoFileProviderwhich provides aCAutoFileinterface toFuzzedDataProviderWriteToStream(…)/ReadFromStream(…)CAutoFile(streams.h)CBufferedFile(streams.h)LoadExternalBlockFile(...)(validation.h)CBlockPolicyEstimator::ReadandCBlockPolicyEstimator::Write(policy/fees.h)See
doc/fuzzing.mdfor information on how to fuzz Bitcoin Core. Don't forget to contribute any coverage increasing inputs you find to the Bitcoin Core fuzzing corpus repo.Happy fuzzing :)