Add fuzzing harness for BanMan
.
See 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.
Happy fuzzing :)
Add fuzzing harness for BanMan
.
See 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.
Happy fuzzing :)
BanMan::Discourage(…)
too: the commit from #19219 is now part of this PR.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, 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.
33+{
34+ FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
35+ const fs::path banlist_file = GetDataDir() / "fuzzed_banlist.dat";
36+ fs::remove(banlist_file);
37+ {
38+ BanMan ban_man{banlist_file, nullptr, ConsumeBanTimeOffset(fuzzed_data_provider)};
BanMan ban_man{banlist_file, nullptr, ConsumeBanTimeOffset(fuzzed_data_provider)};
could be its own fuzz test? It would basically fuzz DeserializeFileDB
in src/addrdb.cpp
.
Tested ACK :)
Ran against ad953a2 for about 18 hours on a Ubuntu VM with 2 core and 2g RAM. It was pretty slow even for a weak VM, probably because of file io when dumping the banlist.
0start_time : 1594037321
1last_update : 1594098196
2fuzzer_pid : 16179
3cycles_done : 0
4execs_done : 379262
5execs_per_sec : 6.20
6paths_total : 341
7paths_favored : 108
8paths_found : 340
9paths_imported : 0
10max_depth : 4
11cur_path : 134
12pending_favs : 81
13pending_total : 301
14variable_paths : 329
15stability : 98.81%
16bitmap_cvg : 13.03%
17unique_crashes : 0
18unique_hangs : 0
19last_path : 1594098172
20last_crash : 0
21last_hang : 0
22execs_since_crash : 379262
23exec_timeout : 320
24afl_banner : banman
25afl_version : 2.57b
26target_mode : no_forksrv
27command_line : afl/afl-fuzz -i inputs/ -o outputs/ -m500 -- src/test/fuzz/banman
28slowest_exec_ms : 320
29peak_rss_mb : 53
Coverage for banman.cpp
here: https://crypt-iq.github.io/btc/fuzz-cov/src/banman.cpp.gcov.html
21 #include <test/fuzz/FuzzedDataProvider.h>
22 #include <test/fuzz/fuzz.h>
23+#include <test/util/setup_common.h>
24 #include <txmempool.h>
25 #include <uint256.h>
26 #include <version.h>