REGTESTS: quic: NEW_CONNECTION_ID must not reference a retired CID
A NEW_CONNECTION_ID frame stored pointers to the CID and the stateless
reset token of its quic_connection_id. RETIRE_CONNECTION_ID frees that
object at once, while a frame built for it may still be queued, in flight,
or duplicated later for a retransmission: it was then built from freed
memory.
Retiring sequence numbers 1 and 2 in the same packet is enough to reach
it: the second RETIRE frees the CID the first NEW_CONNECTION_ID frame
still points to. With the pool cache, the freed object is handed back to
the next CID of the same connection, so two frames carry the same CID,
which the client detects. Without it (ASan, DEBUG_DONT_SHARE_POOLS), freed
heap content is sent and the sanitizer reports a use-after-free.
The test drives a real handshake through the QUIC client in
reg-tests/quic/qclient, then retires both sequence numbers in one packet,
and checks two things: no duplicate CID is advertised for two different
sequence numbers, and the connection is closed with a transport error of
type PROTOCOL_VIOLATION, as RFC 9000 19.16 requires for a sequence number
that was never sent. A crash instead of the CONNECTION_CLOSE frame leaves
the test waiting, which also fails it.
It needs the Python client, so it carries '#REGTEST_EXTRA=qclient' and
only runs when requested.
Covers
827354038 and
a50bb45ba.