-
Notifications
You must be signed in to change notification settings - Fork 725
Fuzzing framework support #2252
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
Fuzzing framework support #2252
Conversation
ace0c21 to
eb7c315
Compare
850425b to
c6cae40
Compare
433dac7 to
9f54131
Compare
|
Short update, As the changes are pretty isolated from everything else, only touching the new fuzzing framework, this PR shouldn't be too hard to review even when it has a good number of commits. |
0612b76 to
94eb714
Compare
94eb714 to
a5f23cd
Compare
random-zebra
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.
This is looking awesome. Been testing with AFL for a while and all is good.
Still need to check libfuzzer and the python script.
Some initial feedback while going through the code: needs rebase on master (and slight rework) for the changes to CheckTransaction, and the documentation could use a bit of "pivx-fication".
.travis/test_06_script_b.sh
Outdated
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.
Since we are no longer using Travis, it would be awesome to have the same thing for GA in the future.
a5f23cd to
0df5cec
Compare
|
Rebased on master + updated per feedback.
|
31329ee to
0d3af08
Compare
|
Rebased on master so this work does not get behind. |
random-zebra
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.
ACK 0d3af08cc24c9980862d95c9fd4ec4caeec01029 (didn't complete all the inputs... it's going too slow here).
Great job 🥃
I think this can be merged already, as it is a completely separated module, not touching the core code directly. Other upgrades can be done in successive pull requests.
|
I'm getting a linker error when building with Index: src/Makefile.test.include
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/Makefile.test.include b/src/Makefile.test.include
--- a/src/Makefile.test.include (revision 5f0ae0f7f4863ec6c75f8124b5331403003df9b3)
+++ b/src/Makefile.test.include (date 1620471251595)
@@ -198,7 +198,7 @@
if ENABLE_ZMQ
test_test_pivx_fuzzy_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
endif
-test_test_pivx_fuzzy_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBUNIVALUE) $(LIBBITCOIN_ZEROCOIN) \
+test_test_pivx_fuzzy_LDADD += $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_ZEROCOIN) $(LIBBITCOIN_UTIL) $(LIBUNIVALUE) \
$(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(LIBSECP256K1) $(EVENT_LIBS) $(EVENT_PTHREADS_LIBS)
if ENABLE_WALLET
test_test_pivx_fuzzy_LDADD += $(LIBBITCOIN_WALLET)
Other than this, I agree it could be merged sooner rather than later. Also, do we want to eventually maintain our own clone of the |
This avoids calling things like pubkey_parse with a null context argument.
Enable the `afl-clang-fast++` features deferred forkserver (`__AFL_INIT`) and persistent mode (`__AFL_LOOP(1000)`).
Before this patch:
```
$ afl-fuzz -i input -o output -m512 -- src/test/test_bitcoin_fuzzy
[*] Validating target binary...
[!] WARNING: The target binary is pretty slow! See /usr/local/share/doc/afl/perf_tips.txt.
[+] Here are some useful stats:
Test case count : 1 favored, 0 variable, 1 total
Bitmap range : 1072 to 1072 bits (average: 1072.00 bits)
Exec timing : 20.4k to 20.4k us (average: 20.4k us)
…
exec speed : 57.58/sec (slow!)
exec speed : 48.35/sec (slow!)
exec speed : 53.78/sec (slow!)
```
After this patch:
```
$ afl-fuzz -i input -o output -m512 -- src/test/test_bitcoin_fuzzy
[*] Validating target binary...
[+] Persistent mode binary detected.
[+] Deferred forkserver binary detected.
[+] Here are some useful stats:
Test case count : 1 favored, 0 variable, 1 total
Bitmap range : 24 to 24 bits (average: 24.00 bits)
Exec timing : 114 to 114 us (average: 114 us)
…
exec speed : 15.9k/sec
exec speed : 13.1k/sec
exec speed : 15.1k/sec
```
This is a crash cause, only affecting us because we use the param for data deserialization like the block index.
Coming from btc@fab2daa026494cdacda530f1253eb43cf0f1576c
The coverage statistics are not stable across clang versions
….) and other CTransaction related functions Based on btc@0a573682f24d20cb178b8b6f97c35ec46901c4db with PIVX changes on top.
adaptation of btc@897849d8c225045f0dd3a2fe99b5d69bdf84b4e2 without the objects that we don't have.
…und-trip equality where possible. Avoid code repetition.
Coming straight from btc@6feb46c3721605f6ae54d7e635a06f82cd7c1449
|
Hmm that is weird, i have been able to compile the fuzz target in macOS and linux (clang and gcc) fine all of this time and zebra too. But can add the link order change, compiled fine with it as well. About the i'm planning to push the new repo when we finish #2267 work list, the modifications and news included there make some of the current inputs invalid, which will force us to restart the entire fuzzing process to generate the correct inputs (which is so so slow and cpu consuming that is better to do it once the new changes are settled). |
0d3af08 to
d059544
Compare
|
Rebased on master + included the libzerocoin link order change. Ready to go. |
random-zebra
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 d059544 and merging...
As the title says, adding fuzzing framework support so we can start getting serious on this area as well.
Adapted the following PRs: