I think that the continue here is right for the fail-closed checks, but it also skips the readiness, m_recv_twice and m_send_after_short checks. Those describe what the handler did during the run, whether or not the socket survived.
The problem is that the bugs these checks look for usually end with the handler closing the socket. For example, a read without RecvEvent on a healthy FuzzedSock mostly returns 0 or an error, and the handler then calls CloseSocketDisconnect(). The node now has no socket, so the check never runs. The violation is only seen when the bad read happens to return data.
I tested this with a mutant that also reads on SendEvent:
diff --git a/src/net.cpp b/src/net.cpp
index f31604f6c5..b781371074 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2218,7 +2218,7 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
}
}
- if (recvSet || errorSet)
+ if (recvSet || errorSet || sendSet)
{
// typical socket buffer is 8K-64K
uint8_t pchBuf[0x10000];
My clanker suggests to keep a reference to each socket before the handler runs, check behaviour on that reference, and only tie the fail-closed checks to whether the node still holds it.