Skip to content

Commit ed9c3a2

Browse files
committed
BUG/MINOR: quic: Too short datagram during packet building failures (aws-lc only)
This issue was reported by Ilya (@chipitsine) when building haproxy against aws-lc in GH #2663 where handshakeloss and handshakecorruption interop tests could lead haproxy to crash after having built too short datagrams: FATAL: bug condition "first_pkt->type == QUIC_PACKET_TYPE_INITIAL && (first_pkt->flags & (1UL << 0)) && length < 1200" matched at src/quic_tx.c:163 call trace(13): | 0x55f4ee4dcc02 [ba d9 00 00 00 48 8d 35]: main-0x195bf2 | 0x55f4ee4e3112 [83 3d 2f 16 35 00 00 0f]: qc_send+0x11f3/0x1b5d | 0x55f4ee4e9ab4 [85 c0 0f 85 00 f6 ff ff]: quic_conn_io_cb+0xab1/0xf1c | 0x55f4ee6efa82 [48 c7 c0 f8 55 ff ff 64]: run_tasks_from_lists+0x173/0x9c2 | 0x55f4ee6f05d3 [8b 7d a0 29 c7 85 ff 0f]: process_runnable_tasks+0x302/0x6e6 | 0x55f4ee671bb7 [83 3d 86 72 44 00 01 0f]: run_poll_loop+0x6e/0x57b | 0x55f4ee672367 [48 8b 1d 22 d4 1d 00 48]: main-0x48d | 0x55f4ee6755e0 [b8 00 00 00 00 e8 08 61]: main+0x2dec/0x335d This could happen after Handshake packet building failures which follow a successful Initial packet into the same datagram. In this case, the datagram could be emitted with a too short length (<1200 bytes). To fix this, store the datagram only if the first packet is not an Initial packet or if its length is big enough (>=1200 bytes). Must be backported as far as 2.6. (cherry picked from commit eb1a097) [fl: same patch wich <wrlen> replaced by <dlen> (datagram length)] Signed-off-by: Frederic Lecaille <[email protected]>
1 parent 73843d5 commit ed9c3a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/quic_tx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,8 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf,
610610
/* If there was already a correct packet present, set the
611611
* current datagram as prepared into <cbuf>.
612612
*/
613-
if (prv_pkt)
613+
if (first_pkt && (first_pkt->type != QUIC_PACKET_TYPE_INITIAL ||
614+
dglen >= QUIC_INITIAL_PACKET_MINLEN))
614615
qc_txb_store(buf, dglen, first_pkt);
615616
TRACE_PROTO("could not prepare anymore packet", QUIC_EV_CONN_PHPKTS, qc, qel);
616617
goto out;

0 commit comments

Comments
 (0)