In qc_notify_cc_of_newly_acked_pkts() the ->rs.delivered field of a TX
packet is unconditionally read for each newly acknowledged packet. But
->rs is filled in at TX time by quic_cc_drs_on_pkt_sent() (called from
drs_on_transmit() under QUIC_FL_TX_PACKET_ACK_ELICITING guard) for
ack-eliciting packets only. For a non ack-eliciting packet, e.g. a pure
ACK packet, which can be acknowledged by a peer, ->rs has never been
written and this read returns an indeterminate value.
This value is consumed by quic_cc_drs_on_ack_recv() and on_ack_rcvd()
which may corrupt the delivery rate sampling round counting
(drs->round_count, drs->next_round_delivered): a stale value from a
previously recycled packet freezes the round detection, a null one
spuriously increments round_count. Only BBR is affected: cubic neither
provides get_drs() nor on_ack_rcvd().
Fix this by reading ->rs.delivered for ack-eliciting packets only, as
already done for the call to quic_cc_drs_update_rate_sample() just
below, and for on_pkt_lost() in quic_loss.c. Also document in
quic_tx_packet_init() that ->rs is deliberately left uninitialized and
must never be read for a non ack-eliciting packet.
Thank you to @brhenc for having reported this bug in GH #3587.
This bug was introduced by
44af88d85 ("MINOR: quic: RX part
modifications to support BBR") with the delivery rate sampling support.
This must be backported up to v3.2.
if (pkt->largest_acked_pn != -1)
qc_treat_ack_of_ack(qc, &pkt->pktns->rx.arngs, pkt->largest_acked_pn);
bytes_delivered += pkt->len;
- pkt_delivered = pkt->rs.delivered;
+ /* Delivery rate sampling is applied to ack-eliciting
+ * packets only: never read it for the other ones.
+ */
+ if (pkt->flags & QUIC_FL_TX_PACKET_ACK_ELICITING)
+ pkt_delivered = pkt->rs.delivered;
ev.ack.acked = pkt->in_flight_len;
ev.ack.time_sent = pkt->time_sent_ms;
ev.ack.pn = pkt->pn_node.key;
pkt->largest_acked_pn = -1;
pkt->flags = 0;
pkt->refcnt = 0;
+ /* Note that <pkt->rs> is deliberately left uninitialized here: it is
+ * filled in at TX time for ack-eliciting packets only by
+ * quic_cc_drs_on_pkt_sent() and must never be read for a
+ * non ack-eliciting packet.
+ */
}
/* Build a packet into a buffer at <pos> position, <end> pointing to one byte past