From fae067ec4a408ca7adb7407e93d55d84ab2a8adb Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 21 Jul 2026 18:57:42 +0200 Subject: [PATCH 1/2] fuzz: Avoid dangling prevoutfetch threads after AFL fork --- src/test/util/setup_common.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index bcf637784d7..8c832976722 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -307,8 +307,10 @@ ChainTestingSetup::ChainTestingSetup(const ChainType chainType, TestOpts opts) .check_block_index = 1, .notifications = *m_node.notifications, .signals = m_node.validation_signals.get(), - // Use no worker threads while fuzzing to avoid non-determinism + // Use no worker threads while fuzzing to avoid racy non-determinism + // and dangling thread handles if AFL forks after initialization. .worker_threads_num = EnableFuzzDeterminism() ? 0 : 2, + .prevoutfetch_threads_num = EnableFuzzDeterminism() ? 0 : 2, }; if (opts.min_validation_cache) { chainman_opts.script_execution_cache_bytes = 0; From faada35f9c09844d0aeec7025d06a94427671a22 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 21 Jul 2026 19:39:40 +0200 Subject: [PATCH 2/2] fuzz: [refactor] Use 100'000 digit separator in __AFL_LOOP This makes it easier to glance the exact value. --- src/test/fuzz/fuzz.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/fuzz/fuzz.cpp b/src/test/fuzz/fuzz.cpp index 7fba26ddb0b..8c1def4338a 100644 --- a/src/test/fuzz/fuzz.cpp +++ b/src/test/fuzz/fuzz.cpp @@ -231,7 +231,7 @@ int main(int argc, char** argv) // Enable AFL persistent mode. Requires compilation using afl-clang-fast++. // See fuzzing.md for details. const uint8_t* buffer = __AFL_FUZZ_TESTCASE_BUF; - while (__AFL_LOOP(100000)) { + while (__AFL_LOOP(100'000)) { size_t buffer_len = __AFL_FUZZ_TESTCASE_LEN; test_one_input({buffer, buffer_len}); }