fuzz: Use __AFL_SHM_ID for naming test directories #34445

pull marcofleon wants to merge 1 commits into bitcoin:master from marcofleon:2026/01/afl-shm-id changing 1 files +11 −2
  1. marcofleon commented at 2:17 pm on January 29, 2026: contributor

    During long multicore fuzzing campaigns with AFL++, stale datadirs can eventually accumulate from time outs, resulting in disk running out of space (see #28811). The easiest way to reproduce this is by running our utxo_total_supply target using multiple cores with AFL++ and observing the crashes that occur because of all the directories in /tmp/test_common\ bitcoin/utxo_total_supply/.

    Fix this by using the AFL++ shared memory ID to name the test dirs and cleaning it up before each setup. This ID is unique per AFL++ instance, so multiple cores can run in parallel without conflicts.

    Fixes https://github.com/bitcoin/bitcoin/issues/28811

  2. fuzz: Use `__AFL_SHM_ID` for naming test directories
    Use the AFL++ shared memory ID environment variable to create
    a deterministic datadir path. This prevents accumulation of stale
    directories after a fuzz iteration crashes or times out. During
    long fuzz campaigns, this accumulation has occasionally resulted
    in running out of disk space.
    d3e681bc06
  3. DrahtBot added the label Fuzzing on Jan 29, 2026
  4. DrahtBot commented at 2:17 pm on January 29, 2026: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK dergoegge, maflcko

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. dergoegge approved
  6. dergoegge commented at 4:20 pm on January 29, 2026: member
    utACK d3e681bc06758fe0686cd96fcfd4a1c4c5af62b4
  7. maflcko commented at 5:27 pm on January 29, 2026: member
    Seems fine, but are there any docs? https://duckduckgo.com/?q=__AFL_SHM_ID+site%3Aaflplus.plus only gives one libafl result?
  8. marcofleon commented at 6:04 pm on January 29, 2026: contributor

    Yeah not much documentation (if any), but I figured it’s fine to use as it’s been around forever (since 2.52c):

    https://github.com/AFLplusplus/AFLplusplus/blob/bcc0347eefa05275cea221f8baad8abe7e091872/config.h#L271

    And it’s such a critical part of how AFL++ tells the target where to write coverage.

  9. maflcko commented at 6:20 pm on January 29, 2026: member
    lgtm ACK d3e681bc06758fe0686cd96fcfd4a1c4c5af62b4
  10. fanquake merged this on Jan 30, 2026
  11. fanquake closed this on Jan 30, 2026


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: 2026-02-07 09:13 UTC

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