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
build: build fuzz tests by default #20936
Conversation
Concept ACK on building fuzz tests by default, but needs squashing and fixing of failing CI jobs :) Haven't reviewed any code or build changes. |
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.
I'd suggest splitting up this PR, because it seems like there are at least two separate changes here. i.e f1be902 "Allow building the fuzz tests under windows" shouldn't be related to whether or not we build the fuzz tests by default.
In any case, you need to rebase and fix up your branch, so that it only contains your changes. You can't have merge commits like 04f5799. It looks like you've also got the same changes in multiple commits, i.e 622a2e7 and 0f2bdb1.
Please don't close and open a new PR.
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. |
The standard "formula" for a generic swap is: ...
{
using std::swap;
swap(a, b);
}
... Not sure what the problem is, but maybe that's worth trying. |
Thanks, I just hadn't looked carefully enough - it was a swap where one side was a vector location, and Element happened to be bool. Fingers crossed that this fixed it and I can clean up for review. |
Well...almost there. I tried for a while to squash things down into a single commit, but I think Ive failed. The correct patch is at c7746f0 (except for the fact that I accidentally chopped off the first two lines of the commit message and now the linter is complaining), but I don't know how to get rid of the history (I used git rebase -i and manually squashed/dropped and this was the result). If someone could tell me how to fix this that would be much appreciated. As far as the actual review, the substring match that I introduced feels kind of sketchy but I wasn't sure how else to accomplish what I wanted. The intent was to do some stuff only when libfuzzer was linked, which is what I thought the old check wanted to do as well but it still passed (that is, suppressed a main function etc) on e.g -fsanitize=thread. So I'm confused about what's going on there and would like feedback on that part in particular. |
If you want to squash everything into one commit: Reset the state to the latest commit that is in your branch, but not one of your changes.
Now commit the staged changes with a message
push as usual ... |
d545738
to
b50884e
Compare
Code-wise, this looks pretty good, and in a short test it also seems to work. I'm not entirely sure about the meaning of
So I think this leads to problems if you'd want to fuzz with AFL. You'd need to specify (or get default)
|
@sipa Based on your comment I wasn't sure if I should make the change you suggested or wait for someone else to weigh in, but I wanted to make sure that I'm not dropping the ball on anything. I agree that your suggestion would be easy to implement. If we don't want to add another flag (perhaps desirable from a usability perspective?), I could also just disable non-fuzz targets when building with AFL or Honggfuzz. |
@danben Yeah, up to you. Feel free to keep the PR as-is. I don't think there is much convenience difference; in general nobody should touch --disable-fuzz-binary in general (except maybe we do so for release builds). |
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.
I couldn't build a library with afl++, though the binaries did compile.
I expect this issue to "fix itself" once you address #20936 (comment)
root@9d90aa3c2826:/bitcoin# make
Making all in src
make[1]: Entering directory '/bitcoin/src'
make[2]: Entering directory '/bitcoin/src'
make[3]: Entering directory '/bitcoin'
make[3]: Leaving directory '/bitcoin'
CXXLD libbitcoinconsensus.la
afl-cc ++3.01a by Michal Zalewski, Laszlo Szekeres, Marc Heuse - mode: LLVM-PCGUARD
Using unoptimized trace-pc-guard, upgrade to llvm 10.0.1+ for enhanced version.
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:80: multiple definition of `__afl_area_ptr'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:80: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:81: multiple definition of `__afl_area_ptr_backup'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:81: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:79: multiple definition of `__afl_area_ptr_dummy'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:79: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_auto_early':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1045: multiple definition of `__afl_auto_early'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1045: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_auto_first':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1088: multiple definition of `__afl_auto_first'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1088: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_auto_init':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1033: multiple definition of `__afl_auto_init'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1033: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_auto_second':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1057: multiple definition of `__afl_auto_second'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1057: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:(.tbss+0x24): multiple definition of `__afl_cmp_counter'; /AFLplusplus/afl-compiler-rt.o:(.tbss+0x24): first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_coverage_discard':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1422: multiple definition of `__afl_coverage_discard'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1422: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_coverage_interesting':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1452: multiple definition of `__afl_coverage_interesting'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1452: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_coverage_off':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1400: multiple definition of `__afl_coverage_off'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1400: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_coverage_on':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1412: multiple definition of `__afl_coverage_on'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1412: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_coverage_discard':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1432: multiple definition of `__afl_coverage_skip'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1432: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:85: multiple definition of `__afl_fuzz_len'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:85: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_manual_init':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1004: multiple definition of `__afl_manual_init'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1004: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:88: multiple definition of `__afl_map_size'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:88: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_persistent_loop':
llvm_mode/instrumentation/afl-compiler-rt.o.c:945: multiple definition of `__afl_persistent_loop'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:945: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:(.tbss+0x20): multiple definition of `__afl_prev_ctx'; /AFLplusplus/afl-compiler-rt.o:(.tbss+0x20): first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:(.tbss+0x0): multiple definition of `__afl_prev_loc'; /AFLplusplus/afl-compiler-rt.o:(.tbss+0x0): first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:95: multiple definition of `__afl_selective_coverage_temp'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:95: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__afl_trace':
llvm_mode/instrumentation/afl-compiler-rt.o.c:135: multiple definition of `__afl_trace'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:135: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook1':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1212: multiple definition of `__cmplog_ins_hook1'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1212: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook2':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1235: multiple definition of `__cmplog_ins_hook2'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1235: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook4':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1256: multiple definition of `__cmplog_ins_hook4'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1256: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook8':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1277: multiple definition of `__cmplog_ins_hook8'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1277: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_rtn_hook':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1365: multiple definition of `__cmplog_rtn_hook'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1365: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook1':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1212: multiple definition of `__sanitizer_cov_trace_cmp1'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1212: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook2':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1235: multiple definition of `__sanitizer_cov_trace_cmp2'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1235: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook4':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1256: multiple definition of `__sanitizer_cov_trace_cmp4'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1256: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook8':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1277: multiple definition of `__sanitizer_cov_trace_cmp8'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1277: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook1':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1212: multiple definition of `__sanitizer_cov_trace_const_cmp1'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1212: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook2':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1235: multiple definition of `__sanitizer_cov_trace_const_cmp2'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1235: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook4':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1256: multiple definition of `__sanitizer_cov_trace_const_cmp4'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1256: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__cmplog_ins_hook8':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1277: multiple definition of `__sanitizer_cov_trace_const_cmp8'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1277: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__sanitizer_cov_trace_pc_guard':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1148: multiple definition of `__sanitizer_cov_trace_pc_guard'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1148: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__sanitizer_cov_trace_pc_guard_init':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1163: multiple definition of `__sanitizer_cov_trace_pc_guard_init'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1163: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `__sanitizer_cov_trace_switch':
llvm_mode/instrumentation/afl-compiler-rt.o.c:1326: multiple definition of `__sanitizer_cov_trace_switch'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:1326: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `at_exit':
llvm_mode/instrumentation/afl-compiler-rt.o.c:129: multiple definition of `at_exit'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:129: first defined here
/usr/bin/ld: /AFLplusplus/afl-compiler-rt.o: in function `send_forkserver_error':
llvm_mode/instrumentation/afl-compiler-rt.o.c:162: multiple definition of `send_forkserver_error'; /AFLplusplus/afl-compiler-rt.o:llvm_mode/instrumentation/afl-compiler-rt.o.c:162: first defined here
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Makefile:5482: libbitcoinconsensus.la] Error 1
make[2]: Leaving directory '/bitcoin/src'
make[1]: *** [Makefile:15061: all-recursive] Error 1
make[1]: Leaving directory '/bitcoin/src'
make: *** [Makefile:809: all-recursive] Error 1
src/cuckoocache.h
Outdated
// Can't std::swap a std::vector<bool>::reference and a bool&. | ||
Element el = std::move(table[last_loc]); | ||
table[last_loc] = std::move(e); | ||
e = std::move(el); |
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.
I don't really like changing code in a build change. Maybe exclude the failing ci config via --disable-fuzz
for now?
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.
Actually I'm a bit baffled by this one - the reason for this change was the instantiation of a bool cache in src/test/fuzz/cuckoocache.cpp, which looks like it would have been built whenever enable-fuzz was true. I don't understand how that ever compiled, but if you don't know the answer offhand I'll investigate.
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.
All compilers are broken (as in: They compile wrong code without error, or conversely compile correct code into an incorrect binary). But we should document this brokenness as best as we can, and fix incorrect code separate from feature changes or refactoring or build system changes. Mixing everything into one commit/patchset will make it harder to review and bisect later on.
src/test/fuzz/fuzz.cpp
Outdated
__attribute__((weak)) int main(int argc, char** argv) | ||
#endif |
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.
I don't really like changing code in a build change. Maybe exclude the failing ci config via --disable-fuzz
for now?
src/test/fuzz/netaddress.cpp
Outdated
#include <netinet/in.h> | ||
#endif |
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.
I don't really like changing code in a build change. Maybe exclude the failing ci config via --disable-fuzz
for now?
src/test/fuzz/string.cpp
Outdated
(void)ShellEscape(random_string_1); | ||
#endif |
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.
I don't really like changing code in a build change. Maybe exclude the failing ci config via --disable-fuzz
for now?
src/test/fuzz/util.h
Outdated
const in_addr v4_addr = { | ||
.s_addr = fuzzed_data_provider.ConsumeIntegral<uint32_t>()}; | ||
#endif |
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.
I don't really like changing code in a build change. Maybe exclude the failing ci config via --disable-fuzz
for now?
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.
So this should probably be --disable-fuzz-binary
in the windows ci (instead of my suggestion --disable-fuzz
, which might not go well with how configure is supposed to work)
…ests dee2d6f fuzz: Avoid designated initialization (C++20) in fuzz tests (practicalswift) Pull request description: Avoid designated initialization (C++20) in fuzz tests. Context: bitcoin/bitcoin#20197 (comment), bitcoin/bitcoin#20936 (comment) ACKs for top commit: MarcoFalke: cr ACK dee2d6f dhruv: code review ACK dee2d6f ajtowns: utACK dee2d6f Tree-SHA512: 5940fab6e97a2b11dd3b1475d2cffa2840dc2e6ec34bd9f9df90f948709cab98fd1c513d5dd104816d33a525a6e9710b8715b02db941e35d84f92bc211f56d1d
c7f35f7
to
44825f7
Compare
Turned review back on. Two things to note:
|
… fuzz tests dee2d6f fuzz: Avoid designated initialization (C++20) in fuzz tests (practicalswift) Pull request description: Avoid designated initialization (C++20) in fuzz tests. Context: bitcoin#20197 (comment), bitcoin#20936 (comment) ACKs for top commit: MarcoFalke: cr ACK dee2d6f dhruv: code review ACK dee2d6f ajtowns: utACK dee2d6f Tree-SHA512: 5940fab6e97a2b11dd3b1475d2cffa2840dc2e6ec34bd9f9df90f948709cab98fd1c513d5dd104816d33a525a6e9710b8715b02db941e35d84f92bc211f56d1d
configure.ac
Outdated
@@ -1221,6 +1227,14 @@ dnl it would break GCC's #include_next. | |||
AC_DEFUN([SUPPRESS_WARNINGS], | |||
[$(echo $1 |${SED} -E -e 's/(^| )-I/\1-isystem /g' -e 's;-isystem /usr/include([/ ]|$);-I/usr/include\1;g')]) | |||
|
|||
AC_MSG_CHECKING([whether test/fuzz/fuzz main function is needed]) | |||
if [[[ $use_sanitizers == *"fuzzer"* ]]]; then |
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.
I am pretty sure this will break honggfuzz. Is there anything wrong with how this was checked previously?
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.
Ok, once you rebase I expect honggfuzz to be broken
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.
Concept ACK. Looks better now, except that it breaks honggfuzz
@MarcoFalke Prior to reopening I built and ran honggfuzz (as per doc/fuzzing.md) with no issue. Perhaps it's something to do with my system; how does it break for you? Re: your question above, I had changed it because (for reasons that I still don't quite understand) the check would pass for me even when specifying e.g. --fsanitize=thread which caused several CI tests to fail now that the fuzz targets are built. That said, I would have expected the old check to do the right thing so I'm fairly confused by this. |
Oh, sorry. I was testing Edit: Broken on master and this pr. |
I am incredibly confused by this as well. Tried to fix in #21080 |
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
44825f7
to
0a6aa39
Compare
I think what you want now is:
|
Yep, got it changed locally and just testing everything now. Should be ready soon. |
@MarcoFalke Strangely, now I'm seeing the same issue as in #19633. I reinstalled boost and tried a fresh build but it did not help. Pushing blindly for now. |
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 on this commit if the ci is green. Will test tomorrow
Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits |
This fixes issue bitcoin#19388. The changes are as follows: - Add a new flag to configure, --enable-fuzz-binary, which allows building test/fuzz/fuzz regardless of whether we are building to do actual fuzzing - Set -DPROVIDE_MAIN_FUNCTION whenever --enable-fuzz is no - Add the following libraries to FUZZ_SUITE_LD_COMMON: - LIBBITCOIN_WALLET - SQLLITE_LIBS - BDB_LIBS - if necessary, some or all of: - NATPMP_LIBS - MINIUPNPC_LIBS - LIBBITCOIN_ZMQ / ZMQ_LIBS
04fc96e
to
32cbb06
Compare
review ACK 32cbb06 📭 Show signature and timestampSignature:
Timestamp of file with hash |
Upgrade to Tested ACK for libfuzzer and honggfuzz |
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.
left some ideas for follow-ups
endif | ||
|
||
if ENABLE_FUZZ | ||
|
||
FUZZ_SUITE_LDFLAGS_COMMON = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS) |
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.
unrelated style nit: This is only used once, so you can inline it
@@ -1271,6 +1278,8 @@ else | |||
QT_DBUS_INCLUDES=SUPPRESS_WARNINGS($QT_DBUS_INCLUDES) | |||
QT_TEST_INCLUDES=SUPPRESS_WARNINGS($QT_TEST_INCLUDES) | |||
fi | |||
|
|||
CPPFLAGS="$CPPFLAGS -DPROVIDE_MAIN_FUNCTION" |
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.
unrelated style nit: This can be called DPROVIDE_FUZZ_MAIN_FUNCTION
for clarity
@@ -16,4 +16,5 @@ export RUN_UNIT_TESTS_SEQUENTIAL="true" | |||
export RUN_UNIT_TESTS="false" | |||
export GOAL="install" | |||
export PREVIOUS_RELEASES_TO_DOWNLOAD="v0.15.2 v0.16.3 v0.17.2 v0.18.1 v0.19.1" | |||
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports --enable-debug CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\" --with-boost-process" | |||
export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-glibc-back-compat --enable-reduce-exports | |||
--enable-debug --disable-fuzz-binary CFLAGS=\"-g0 -O2 -funsigned-char\" CXXFLAGS=\"-g0 -O2 -funsigned-char\" --with-boost-process" |
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.
feel free to follow up with pull requests to remove the temporary disable-fuzz-binary
@@ -13,7 +13,7 @@ export PACKAGES="python3 nsis g++-mingw-w64-x86-64 wine-binfmt wine64 file" | |||
export RUN_FUNCTIONAL_TESTS=false | |||
export RUN_SECURITY_TESTS="true" | |||
export GOAL="deploy" | |||
export BITCOIN_CONFIG="--enable-reduce-exports --disable-gui-tests --without-boost-process" | |||
export BITCOIN_CONFIG="--enable-reduce-exports --disable-fuzz-binary --disable-gui-tests --without-boost-process" |
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.
same
After merging this PR Windows cross compiling fails. Fixed in #21115. |
723eb43 test: Fix Windows cross build (Hennadii Stepanov) Pull request description: On master (e51f6c4, after #20936 merge), Windows cross compiling fails: ``` $ make > /dev/null In file included from ./policy/fees.h:12, from policy/fees.cpp:6: policy/fees.cpp: In member function ‘unsigned int CBlockPolicyEstimator::HighestTargetTracked(FeeEstimateHorizon) const’: ./sync.h:232:104: warning: control reaches end of non-void function [-Wreturn-type] 232 | #define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__) | ^ policy/fees.cpp:680:5: note: in expansion of macro ‘LOCK’ 680 | LOCK(m_cs_fee_estimator); | ^~~~ test/fuzz/netaddress.cpp:12:10: fatal error: netinet/in.h: No such file or directory 12 | #include <netinet/in.h> | ^~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:13039: test/fuzz/fuzz-netaddress.o] Error 1 make[2]: *** Waiting for unfinished jobs.... libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only test/fuzz/string.cpp: In function ‘void string_fuzz_target(FuzzBufferType)’: test/fuzz/string.cpp:81:11: error: ‘ShellEscape’ was not declared in this scope 81 | (void)ShellEscape(random_string_1); | ^~~~~~~~~~~ make[2]: *** [Makefile:13543: test/fuzz/fuzz-string.o] Error 1 make[1]: *** [Makefile:15078: all-recursive] Error 1 make: *** [Makefile:812: all-recursive] Error 1 ``` This PR fixes both of errors. ACKs for top commit: MarcoFalke: cr ACK 723eb43 Tree-SHA512: 5d2fba5ca806e64bf92011786d1f868c6624f786bfa753a10316feab7a802a28ec27a4bd25fc26dc289a399895a521c3878ffa1efeff0e540c7245cdb8e4942c
723eb43 test: Fix Windows cross build (Hennadii Stepanov) Pull request description: On master (e51f6c4, after bitcoin#20936 merge), Windows cross compiling fails: ``` $ make > /dev/null In file included from ./policy/fees.h:12, from policy/fees.cpp:6: policy/fees.cpp: In member function ‘unsigned int CBlockPolicyEstimator::HighestTargetTracked(FeeEstimateHorizon) const’: ./sync.h:232:104: warning: control reaches end of non-void function [-Wreturn-type] 232 | #define LOCK(cs) DebugLock<decltype(cs)> PASTE2(criticalblock, __COUNTER__)(cs, #cs, __FILE__, __LINE__) | ^ policy/fees.cpp:680:5: note: in expansion of macro ‘LOCK’ 680 | LOCK(m_cs_fee_estimator); | ^~~~ test/fuzz/netaddress.cpp:12:10: fatal error: netinet/in.h: No such file or directory 12 | #include <netinet/in.h> | ^~~~~~~~~~~~~~ compilation terminated. make[2]: *** [Makefile:13039: test/fuzz/fuzz-netaddress.o] Error 1 make[2]: *** Waiting for unfinished jobs.... libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only test/fuzz/string.cpp: In function ‘void string_fuzz_target(FuzzBufferType)’: test/fuzz/string.cpp:81:11: error: ‘ShellEscape’ was not declared in this scope 81 | (void)ShellEscape(random_string_1); | ^~~~~~~~~~~ make[2]: *** [Makefile:13543: test/fuzz/fuzz-string.o] Error 1 make[1]: *** [Makefile:15078: all-recursive] Error 1 make: *** [Makefile:812: all-recursive] Error 1 ``` This PR fixes both of errors. ACKs for top commit: MarcoFalke: cr ACK 723eb43 Tree-SHA512: 5d2fba5ca806e64bf92011786d1f868c6624f786bfa753a10316feab7a802a28ec27a4bd25fc26dc289a399895a521c3878ffa1efeff0e540c7245cdb8e4942c
… fuzz tests dee2d6f fuzz: Avoid designated initialization (C++20) in fuzz tests (practicalswift) Pull request description: Avoid designated initialization (C++20) in fuzz tests. Context: bitcoin#20197 (comment), bitcoin#20936 (comment) ACKs for top commit: MarcoFalke: cr ACK dee2d6f dhruv: code review ACK dee2d6f ajtowns: utACK dee2d6f Tree-SHA512: 5940fab6e97a2b11dd3b1475d2cffa2840dc2e6ec34bd9f9df90f948709cab98fd1c513d5dd104816d33a525a6e9710b8715b02db941e35d84f92bc211f56d1d
This fixes issue #19388. The changes are as follows:
Fixes #19388