Skip to content

build: Add cov_fuzz target - #18107

Merged
laanwj merged 3 commits into
bitcoin:masterfrom
maflcko:2002-buildCovFuzz
Mar 27, 2020
Merged

laanwj merged 3 commits into
bitcoin:masterfrom
maflcko:2002-buildCovFuzz

Conversation

@maflcko

@maflcko maflcko commented Feb 10, 2020

Copy link
Copy Markdown
Member

Only libFuzzer is supported right now, so clang is required. Thus, this needs a workaround such as #12602 (comment)

Can be tested with:

mkdir build && cd build
../configure --enable-fuzz --with-sanitizers=fuzzer --enable-lcov --enable-lcov-branch-coverage CC=clang CXX=clang++
make $MAKEJOBS
make cov_fuzz

@practicalswift

Copy link
Copy Markdown
Contributor

Strongest possible Concept ACK -- will test :)

BTW, I noticed that the fuzzing coverage link is broken on your otherwise excellent coverage statistics page. Will the merge of this fix that? :)

@maflcko

maflcko commented Feb 10, 2020

Copy link
Copy Markdown
Member Author

Which link is broken? https://marcofalke.github.io/btc_cov/ ?

Note that the fuzzers were running into a stack overflow, thus unable to produce a result. So for a while that page was a 404. This should now be fixed with 657c5e5

@practicalswift

Copy link
Copy Markdown
Contributor

@MarcoFalke Ah, then the issue was temporary. Cannot reproduce today :)

@maflcko

maflcko commented Mar 12, 2020

Copy link
Copy Markdown
Member Author

Strongest possible Concept ACK -- will test :)

@practicalswift Are you still planning to test? 🤔

@practicalswift

Copy link
Copy Markdown
Contributor

@MarcoFalke Absolutely :)

I ran in to some problems - see below.

What versions of gcov, lcov and clang++ are you using? I'm using gcov 7.5.0, lcov 1.13 and clang++ 10.0.0.

$ make distclean
$ ./autogen.sh
$ ./configure --enable-fuzz --with-sanitizers=fuzzer --enable-lcov --enable-lcov-branch-coverage CC=clang CXX=clang++
$ make
$ git clone https://github.com/bitcoin-core/qa-assets
$ make cov_fuzz
…

Run uint256_deserialize with args ['…/src/test/fuzz/uint256_deserialize', '-runs=1', 'qa-assets/fuzz_seed_corpus/uint256_deserialize']
Output: INFO: Seed: 1103855062
INFO: Loaded 1 modules   (1032 inline 8-bit counters): 1032 [0x5624c7ccdb08, 0x5624c7ccdf10),
INFO: Loaded 1 PC tables (1032 PCs): 1032 [0x5624c7ccdf10,0x5624c7cd1f90),
INFO:        0 files found in qa-assets/fuzz_seed_corpus/uint256_deserialize
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: A corpus is not provided, starting from an empty corpus
#2      INITED cov: 119 ft: 120 corp: 1/1b exec/s: 0 rss: 27Mb
#2      DONE   cov: 119 ft: 120 corp: 1/1b lim: 4 exec/s: 0 rss: 27Mb
Done 2 runs in 0 second(s)

/usr/bin/lcov --gcov-tool=/usr/bin/gcov -c --rc lcov_branch_coverage=1 -d …/src --t fuzz-tests -o fuzz.info
Capturing coverage data from …/src
Found gcov version: 7.5.0
geninfo: WARNING: invalid characters removed from testname!
Scanning …/src for .gcda files ...
Found 361 data files in …/src
Processing src/libbitcoin_util_a-fs.gcda
…/src/libbitcoin_util_a-fs.gcno:version '402*', prefer 'A75*'
geninfo: ERROR: GCOV failed for …/src/libbitcoin_util_a-fs.gcda!
Makefile:1321: recipe for target 'fuzz.info' failed
make: *** [fuzz.info] Error 29
rm baseline_filtered.info fuzz.info baseline.info
$ lcov --version
lcov: LCOV version 1.13
$ gcov --version | head -1
gcov (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
$ clang++ --version | head -1
clang version 10.0.0 (https://github.com/llvm/llvm-project.git f1b117394d7f9ae6decf9730ed9d443ca1b54769)

@maflcko

maflcko commented Mar 12, 2020

Copy link
Copy Markdown
Member Author

@practicalswift Have you applied the workaround? #12602 (comment)

@maflcko

maflcko commented Mar 12, 2020

Copy link
Copy Markdown
Member Author

Other than that I use vanilla debian:bullseye with whatever clang comes in there.

@practicalswift

Copy link
Copy Markdown
Contributor

@MarcoFalke Thanks! Works as expected with workaround applied.

@practicalswift

Copy link
Copy Markdown
Contributor

ACK faf7d4f

@laanwj
laanwj merged commit bdc2644 into bitcoin:master Mar 27, 2020
@maflcko
maflcko deleted the 2002-buildCovFuzz branch March 27, 2020 13:33
maflcko pushed a commit that referenced this pull request Aug 8, 2020
…zz directory

90bd476 build: make clean removes .gcda and .gcno files from fuzz directory (eugene)

Pull request description:

  I believe these should also be deleted upon invoking `make clean`. It also garbles the coverage file if you try to fuzz the same harness again.

ACKs for top commit:
  practicalswift:
    ACK 90bd476 -- patch looks correct
  hebasto:
    ACK 90bd476, tested with hints from #12602 and #18107.
  darosior:
    ACK 90bd476

Tree-SHA512: 4b2eb664f64d18bc0385c5a0040b0b9fa6fe470c941ae39c7cb4544c4283427a8d4985517475fe0295c3ab2794b9a2ad4f76b6a443c05d846c97c966add87ca9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 19, 2021
…from fuzz directory

90bd476 build: make clean removes .gcda and .gcno files from fuzz directory (eugene)

Pull request description:

  I believe these should also be deleted upon invoking `make clean`. It also garbles the coverage file if you try to fuzz the same harness again.

ACKs for top commit:
  practicalswift:
    ACK 90bd476 -- patch looks correct
  hebasto:
    ACK 90bd476, tested with hints from bitcoin#12602 and bitcoin#18107.
  darosior:
    ACK 90bd476

Tree-SHA512: 4b2eb664f64d18bc0385c5a0040b0b9fa6fe470c941ae39c7cb4544c4283427a8d4985517475fe0295c3ab2794b9a2ad4f76b6a443c05d846c97c966add87ca9
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants