It may be possible that a peer connection will deadlock, due to software bugs such as #18808.
Fix this by detecting them in the fuzz target.
Can be tested by introducing a bug such as:
0diff --git a/src/net_processing.cpp b/src/net_processing.cpp
1index 1067341495..97495a13df 100644
2--- a/src/net_processing.cpp
3+++ b/src/net_processing.cpp
4@@ -2436,3 +2436,3 @@ void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic
5 if (it != peer.m_getdata_requests.end() && !pfrom.fPauseSend) {
6- const CInv &inv = *it++;
7+ const CInv& inv = *it;
8 if (inv.IsGenBlkMsg()) {
Using a fuzz input such as:
0$ base64 ./timeout-ada0fecaba2b8c46c6e970cf637d9625b01bf7e5
1kNptdNbW1tbWYghvXIpwb25vPQAA////////cwAjLv8AXAB2ZXJhY2sAQW5v/62tra3Pz///////
2//////////////////////9c8GZpbHRlcmxvYWQAAAEAAwAAAABVYwC2XABmaWx0ZXJhZGQAAAAX
3Fxdn/////2V0F861tcqvEmAAACEAAABjYXB0dXJldmUAAH4AgAA1PNfX11x0Z2V0ZGF0YQBDACOw
4AQMAAAAGIm5GERoLWcqvEmBD61u/KMNPOl4zKh/HKLK3PPGIkQ9eE/////////8AAAAAAAAAAFtb
5WyjDTzpeMSofx7K3PNfX11x0Z2V0ZGF0YQBDACMwAQMAAAAGIm5GERoLWcqvEmBD61u/KMNPOl4z
6Kh/Hsrc88YiRD2/Nzc3Nzc3Nzc3NTc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N
7zWWj1NTUudTU1NTU1P///0j+P/9cdHR4AAAAAAAAy/4AAHR4AAAAAAAAP8v+AAD/+P//////////
8AX55bJl8HWnz/////wAgXGF0YVPxY2RkAAAA
And running the fuzz target:
0$ FUZZ=process_messages ./src/test/fuzz/fuzz -runs=1 -timeout=18 ./timeout-ada0fecaba2b8c46c6e970cf637d9625b01bf7e5
1INFO: Running with entropic power schedule (0xFF, 100).
2INFO: Seed: 3436516708
3INFO: Loaded 1 modules (390807 inline 8-bit counters): 390807 [0x55d0d6221e80, 0x55d0d6281517),
4INFO: Loaded 1 PC tables (390807 PCs): 390807 [0x55d0d6281518,0x55d0d6877e88),
5./src/test/fuzz/fuzz: Running 1 inputs 1 time(s) each.
6Running: ./timeout-ada0fecaba2b8c46c6e970cf637d9625b01bf7e5
7ALARM: working on the last Unit for 19 seconds
8 and the timeout value is 18 (use -timeout=N to change)
9==375014== ERROR: libFuzzer: timeout after 19 seconds