wip: Split fuzz binary (take 2) #30882

pull dergoegge wants to merge 3 commits into bitcoin:master from dergoegge:2024-09-split-fuzz changing 16 files +125 −38
  1. dergoegge commented at 3:16 pm on September 12, 2024: member

    Closes #28971

    In addition to the benefits listed in #28971, this should also enable us to use https://github.com/ossf/fuzz-introspector provided by oss-fuzz. Our current runtime harness selection blocks introspector’s static analysis from working properly (e.g. it can’t statically determine which functions are reachable by a given harness).

    This PR uses the approach suggested here: #29010 (comment). The list of available harnesses is determined (prior to compiling) by grepping for harness names in FUZZ_TARGET invocations. When compiling with -DBUILD_INDIVIDUAL_FUZZ_BINARIES=ON, individual binaries for each harness are produced that no longer include the runtime lookup via the FUZZ environment variable.

    0cmake -B build_fuzz \
    1  -DBUILD_FOR_FUZZING=ON \
    2  -DBUILD_INDIVIDUAL_FUZZ_BINARIES=ON \
    3  -DSANITIZERS=fuzzer
    4cmake --build build_fuzz
    

    build_fuzz/src/test/fuzz will contain the individual binaries, which are prefixed with fuzz_*.

    I’m opening this now to get some early feedback, there are still a few things to address:

    • mention -DBUILD_INDIVIDUAL_FUZZ_BINARIES in the docs
    • include wallet harnesses
    • CI job that builds individual binaries (perhaps verify that the list of produced harnesses matches the monolithic binary)
  2. DrahtBot commented at 3:16 pm on September 12, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #31333 (fuzz: Implement G_TEST_GET_FULL_NAME by hodlinator)
    • #28676 ([WIP] Cluster mempool implementation by sdaftuar)
    • #28584 (Fuzz: extend CConnman tests by vasild)

    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.

  3. in src/test/fuzz/util/CMakeLists.txt:7 in 66c288a4cd outdated
    20-
    21-if(NOT FUZZ_BINARY_LINKS_WITHOUT_MAIN_FUNCTION)
    22-  target_compile_definitions(test_fuzz PRIVATE PROVIDE_FUZZ_MAIN_FUNCTION)
    23+if(BUILD_INDIVIDUAL_FUZZ_BINARIES)
    24+  # bash command produces list of harnesses: <harness name> <source file>
    25+  execute_process(
    


    dergoegge commented at 3:20 pm on September 12, 2024:
    Currently an individual test_fuzz_* lib and fuzz_* binary is produced for each harness. It’s kind of ugly to duplicate this loop but I’m not sure to avoid it. Another loop would likely need to be added for the wallet harnesses as well. @hebasto @fanquake @maflcko Any ideas?
  4. dergoegge commented at 3:21 pm on September 12, 2024: member
    Trying to produce an introspector report using this branch: https://github.com/dergoegge/oss-fuzz/tree/2024-09-bitcoin-introspector
  5. dergoegge force-pushed on Sep 12, 2024
  6. DrahtBot added the label CI failed on Sep 13, 2024
  7. DrahtBot commented at 5:07 am on September 13, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/30061858064

    Make sure to run all tests locally, according to the documentation.

    The failure may happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  8. dergoegge force-pushed on Oct 1, 2024
  9. [fuzz] Avoid FUZZ_TARGET invocation in namespace 6f08bc5640
  10. [test] Define G_TRANSLATION_FUN per test binary (fuzz, test_bitcoin, bench) 151a4f585b
  11. wip individual fuzz bins 0cb1f4ca90
  12. dergoegge force-pushed on Oct 1, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me