summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorChris Mason <mason@kernel.org>2026-11-18 10:51:46 -0500
committerPaolo Abeni <pabeni@redhat.com>2026-11-19 14:47:59 +0100
commitfa472d53d9b7aaff384d25f4ca86540d63815113 (patch)
tree6a0e0d03ef344f2e6d6b119aa9879cc4c3276e94 /tools/perf/scripts/python
parent5d2a5ad0367725f2833bbfcec25aae1e69d71ba1 (diff)
tcp: clamp RTT samples in tcp_rtt_estimator()
tcp_rtt_estimator() keeps its state in u32 fields, in microseconds. srtt_us holds 8 times the smoothed RTT, so it wraps at an RTT of 536.9 s. Samples can be larger than that: - For an ACK of retransmitted data, the sample is the timestamp clock minus TSecr, and tcp_rtt_tsopt_us() accepts a sample of up to 2,147 s. - For a SACK of a segment that was never retransmitted, the sample is the age of that segment. Samples from TSecr could wrap these fields when they still held jiffies. The age of a segment can wrap them since commit 740b0f1841f6 ("tcp: switch rtt estimations to usec resolution"), which took the wrap of the smoothed RTT from 2^29 jiffies to 2^29 us. The fix used here is to clamp each sample to 120 s, the largest possible RTO, in tcp_rtt_estimator(), where the samples of all sources meet. The smoothed RTT now saturates at 120 s. A path with a larger real RTT sees that in TCP_INFO, in the pacing rate and in the metrics cache. BPF programs on the RTT callback get the clamped sample too. Found by code inspection (Eric Dumazet), and confirmed with LLM generated reproducers on an unmodified kernel. Fixed by LLM, and tested with the reproducers and existing kernel selftests. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Fixes: 740b0f1841f6 ("tcp: switch rtt estimations to usec resolution") Signed-off-by: Chris Mason <mason@kernel.org> Reviewed-by: Eric Dumazet <edumazet@kernel.org> Link: https://patch.msgid.link/20261118155144.18393-3-mason@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions