Please describe the feature you’d like to see added.
The fuzzing related configuration options are somewhat confusing and redundant and can be simplified.
TLDR: currently --enable-fuzz
does not enable fuzzing.
Is your feature related to a problem, if so please describe it.
Thanks for the discussion yesterday. Correct me if I am wrong below. There are the following options (to ./configure
and in the coming CMake replacement):
--enable-fuzz
(default no), note that this option does not engage the fuzzing framework. That is, it does not enable fuzzing :exclamation::question: :- disables compiling all other targets (e.g.
src/bitcoind
); other targets should be disabled because the fuzzing framework provides its ownmain()
function - forces
--enable-fuzz-binary=yes
- enables
ABORT_ON_FAILED_ASSUME
- disables compiling all other targets (e.g.
--enable-fuzz-binary
(default yes): whether to compilesrc/test/fuzz/fuzz
--with-sanitizers=fuzzer
(default no sanitizers): engage the fuzzing framework, ie enable fuzzing.
Without the fuzzing framework (--with-sanitizers=fuzzer
) src/test/fuzz/fuzz
cannot do fuzzing but it can run existent inputs from e.g. https://github.com/bitcoin-core/qa-assets/tree/main/fuzz_seed_corpus (phony fuzz binary). So currently all of the below produce such a phony fuzz binary:
- compiling by default without any options
- compiling with
--enable-fuzz
- compiling with
--enable-fuzz-binary
Describe the solution you’d like
Ideally there should be one boolean option which enables/disables fuzzing instead of 3:
- when enabled: engage the fuzzing harness (compile with
-fsanitize=fuzzer
), force compilingsrc/test/fuzz/fuzz
(if it is even possible to disable it via another option), force disable all other targets - when disabled: don’t use
-fsanitize=fuzzer
, leave alonesrc/test/fuzz/fuzz
and other build targets to be decided by other options. Ifsrc/test/fuzz/fuzz
is to be build, then create a “phony fuzz” binary which cannot do fuzzing but can execute existent fuzz inputs.
Describe any alternatives you’ve considered
The “enabled/disabled” option can be implicit - if --with-sanitizers=...,fuzzer,...
is used then do as “when enabled” above.