mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
tcp: reject RTT samples from TSecr above 120 s
tcp_rtt_tsopt_us() returns the timestamp clock minus TSecr as an RTT
sample, and accepts up to 2,147 s. If TSecr echoes an old timestamp,
the sample is the age of that timestamp, not an RTT.
tcp_ack_update_rtt() takes this sample for an ACK of retransmitted data.
tcp_rtt_estimator() clamps it to 120 s. The congestion control gets the
sample unclamped, in rs->rtt_us.
tcp_rcv_rtt_measure_ts() takes the same sample for the RTT estimate of
the receive side.
The fix used here is to reject a sample from TSecr above 120 s, for both
callers of tcp_rtt_tsopt_us().
An ACK of retransmitted data whose TSecr is more than 120 s old now
gives no RTT sample. So it no longer resets the backoff, as on a
connection without timestamps.
Found by LLM code inspection, and confirmed with LLM generated
reproducers on an unmodified kernel. Fixed by LLM, and tested with
the reproducers and existing kernel selftests.
Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Chris Mason <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
This commit is contained in:
@@ -901,15 +901,16 @@ new_measure:
|
||||
tp->rcv_rtt_est.time = tp->tcp_mstamp;
|
||||
}
|
||||
|
||||
/* A sample from TSecr above TCP_RTT_MAX_US is bogus, not large. */
|
||||
static s32 tcp_rtt_tsopt_us(const struct tcp_sock *tp, u32 min_delta)
|
||||
{
|
||||
u32 delta, delta_us;
|
||||
|
||||
delta = tcp_time_stamp_ts(tp) - tp->rx_opt.rcv_tsecr;
|
||||
if (tp->tcp_usec_ts)
|
||||
return delta;
|
||||
return delta <= TCP_RTT_MAX_US ? delta : -1;
|
||||
|
||||
if (likely(delta < INT_MAX / (USEC_PER_SEC / TCP_TS_HZ))) {
|
||||
if (likely(delta <= TCP_RTT_MAX_US / (USEC_PER_SEC / TCP_TS_HZ))) {
|
||||
if (!delta)
|
||||
delta = min_delta;
|
||||
delta_us = delta * (USEC_PER_SEC / TCP_TS_HZ);
|
||||
|
||||
Reference in New Issue
Block a user