Skip to content
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: Add cov_fuzz target #18107

Merged
merged 3 commits into from
Mar 27, 2020
Merged

build: Add cov_fuzz target #18107

merged 3 commits into from
Mar 27, 2020

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Feb 10, 2020

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
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
Copy link
Member Author

maflcko commented Feb 10, 2020

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
Contributor

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

@maflcko
Copy link
Member Author

maflcko commented Mar 12, 2020

Strongest possible Concept ACK -- will test :)

@practicalswift Are you still planning to test? 🤔

@practicalswift
Copy link
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
Copy link
Member Author

maflcko commented Mar 12, 2020

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

@maflcko
Copy link
Member Author

maflcko commented Mar 12, 2020

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

@practicalswift
Copy link
Contributor

@MarcoFalke Thanks! Works as expected with workaround applied.

@practicalswift
Copy link
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
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Mar 28, 2020
faf7d4f build: Add cov_fuzz target (MarcoFalke)
fac71e3 build: link fuzz/test_runner.py for out-of-tree builds (MarcoFalke)
faf2c5a build: Remove unused USE_COVERAGE (MarcoFalke)

Pull request description:

  Only libFuzzer is supported right now, so clang is required. Thus, this needs a workaround such as bitcoin#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

ACKs for top commit:
  practicalswift:
    ACK faf7d4f

Tree-SHA512: 6828f8f81d95f6781713d0b09d7eba2ffdb50217e09ca839db61791a4ed70024859c7a0cb01d9eede79166d574dd57ece01f9d9fe2610d4a72a4ca4a4ce0b838
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
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 8, 2020
…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
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Sep 17, 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
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
thelazier pushed a commit to thelazier/dash that referenced this pull request Sep 25, 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