tcp: avoid integer wraps in the RTT estimator and the RTO
Status from this message: This series was applied to netdev/net.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest5 patches 5 repliesApplied 5/5
- v13 patches 9 repliesSuperseded
Changes in v2 from the cover letter
- Patch 1: no code change. New changelog and Fixes: tag (Eric). David suggested "return rto ?: 1;". I kept max(), since tcp_rtt_estimator() ends with max(1U, srtt).
- Patch 2: clamp mrtt_us itself, so that tcp_bpf_rtt() gets the clamped sample (Eric).
- Patch 3: no code change. The part on sample << 3 moved to patch 4.
- Patch 4: new (Eric), with min() instead of min_t() (David).
- Patch 5: new.
Patches in v2 All 5 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | tcp: don't let __tcp_set_rto() return 0include/ net/ | +6 | 0 replies | Applied |
| 2/5 | tcp: clamp RTT samples in tcp_rtt_estimator()include/ net/ | +11 | 0 replies | Applied |
| 3/5 | tcp: reject RTT samples from TSecr above 120 snet/ | +3 | 1 reply | Applied |
| 4/5 | tcp: clamp the samples in tcp_rcv_rtt_update()net/ | +5 | 3 replies | Applied |
| 5/5 | tcp: bound the rto_min of a route in tcp_rto_min()include/ | +2 | 1 reply | Applied |
Reviews trailers per patch
4 of 5 patches have a Reviewed-by or Acked-by.
| Patch | Eric Dumazet |
|---|---|
| 1/5 | |
| 2/5 | R-b |
| 3/5 | R-b |
| 4/5 | R-b |
| 5/5 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH net v2 0/5] tcp: avoid integer wraps in the RTT estimator and the RTO
Hi everyone,
This is v2 of the RTT clamps, with Eric's review folded in.
Patch 1: __tcp_set_rto() never returns 0, so that the backoff recovers from any state of the RTT estimator.
Patch 2: tcp_rtt_estimator() clamps each sample to 120 s, so that srtt_us, mdev_us, rttvar_us and the sum in __tcp_set_rto() can't wrap.
Patch 3: tcp_rtt_tsopt_us() rejects a TSecr sample above 120 s.
Patch 4: new, from Eric's review. tcp_rcv_rtt_update() clamps its samples too, which covers tcp_rcv_rtt_measure().
Patch 5: new. tcp_rto_min() bounds the locked rto_min of a route.
Eric, I have a question on patch 5. You pointed at a locked rto_min of 0 for patch 1. We can also get an RTO of 0 out of tcp_init_metrics(), which doesn't go through __tcp_set_rto(), so I bounded the metric in tcp_rto_min(). For a locked cwnd of 0 you wanted ip_metrics_convert() to reject it instead.
I didn't do that here because claude points out that "rto_min lock 0" is accepted today and mostly works, but just let me know how you want this to look.
Changes since v1:
- Patch 1: no code change. New changelog and Fixes: tag (Eric). David suggested "return rto ?: 1;". I kept max(), since tcp_rtt_estimator() ends with max(1U, srtt).
- Patch 2: clamp mrtt_us itself, so that tcp_bpf_rtt() gets the clamped sample (Eric).
- Patch 3: no code change. The part on sample << 3 moved to patch 4.
- Patch 4: new (Eric), with min() instead of min_t() (David).
- Patch 5: new.
v1: https://lore.kernel.org/all/[email protected]/
This is on top of v7.4-rc3.
Chris Mason (5):
tcp: don't let __tcp_set_rto() return 0
tcp: clamp RTT samples in tcp_rtt_estimator()
tcp: reject RTT samples from TSecr above 120 s
tcp: clamp the samples in tcp_rcv_rtt_update()
tcp: bound the rto_min of a route in tcp_rto_min()
include/net/tcp.h | 14 ++++++++++++-- net/ipv4/tcp_input.c | 21 +++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-)
Signature · 1 line
2.55.0