Skip to contentSkip to conversation

tcp: disallow cwnd undo when switching congestion control

PATCH In review Yuchung Cheng 3 participants 4 messages May 31, 2017 – Jun 2, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcp: disallow cwnd undo when switching congestion control

When the sender switches its congestion control during loss recovery, if the recovery is spurious then it may incorrectly revert cwnd and ssthresh to the older values set by a previous congestion control. Consider a congestion control (like BBR) that does not use ssthresh and keeps it infinite: the connection may incorrectly revert cwnd to an infinite value when switching from BBR to another congestion control.

This patch fixes it by disallowing such cwnd undo operation upon switching congestion control. Note that undo_marker is not reset s.t. the packets that were incorrectly marked lost would be corrected. We only avoid undoing the cwnd in tcp_undo_cwnd_reduction().

---
 net/ipv4/tcp_cong.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/tcp_cong.c +1 -0
index 6e3c512054a6..324c9bcc5456 100644
@@ -180,6 +180,7 @@ void tcp_init_congestion_control(struct sock *sk)
 {
 	const struct inet_connection_sock *icsk = inet_csk(sk);
 
+	tcp_sk(sk)->prior_ssthresh = 0;
 	if (icsk->icsk_ca_ops->init)
 		icsk->icsk_ca_ops->init(sk);
 	if (tcp_ca_needs_ecn(sk))
Signature · 1 line
2.13.0.219.gdb65acc882-goog
#1 lore raw
Quoted 14 lines · On Wed, 31 May 2017 11:21:27 -0700 Yuchung Cheng <[email protected]> wrote:

When the sender switches its congestion control during loss recovery, if the recovery is spurious then it may incorrectly revert cwnd and ssthresh to the older values set by a previous congestion control. Consider a congestion control (like BBR) that does not use ssthresh and keeps it infinite: the connection may incorrectly revert cwnd to an infinite value when switching from BBR to another congestion control.

This patch fixes it by disallowing such cwnd undo operation upon switching congestion control. Note that undo_marker is not reset s.t. the packets that were incorrectly marked lost would be corrected. We only avoid undoing the cwnd in tcp_undo_cwnd_reduction().

Quoted 4 lines

That looks correct. Are there other values of congestion state that should be reset?

#2 lore raw
Quoted 18 lines · Stephen Hemminger
Quoted 14 lines · On Wed, 31 May 2017 11:21:27 -0700 Yuchung Cheng <[email protected]> wrote:

When the sender switches its congestion control during loss recovery, if the recovery is spurious then it may incorrectly revert cwnd and ssthresh to the older values set by a previous congestion control. Consider a congestion control (like BBR) that does not use ssthresh and keeps it infinite: the connection may incorrectly revert cwnd to an infinite value when switching from BBR to another congestion control.

This patch fixes it by disallowing such cwnd undo operation upon switching congestion control. Note that undo_marker is not reset s.t. the packets that were incorrectly marked lost would be corrected. We only avoid undoing the cwnd in tcp_undo_cwnd_reduction().

Quoted 8 lines
Quoted 4 lines

That looks correct. Are there other values of congestion state that should be reset?

Nothing in particular comes up. We found this bug by internally checking insane cwnd values on Google hosts. We might find more :-)

maintainer
#3 lore raw
In reply to Yuchung Cheng

From: Yuchung Cheng <[email protected]>
Date: Wed, 31 May 2017 11:21:27 -0700

Quoted 14 lines

When the sender switches its congestion control during loss recovery, if the recovery is spurious then it may incorrectly revert cwnd and ssthresh to the older values set by a previous congestion control. Consider a congestion control (like BBR) that does not use ssthresh and keeps it infinite: the connection may incorrectly revert cwnd to an infinite value when switching from BBR to another congestion control.

This patch fixes it by disallowing such cwnd undo operation upon switching congestion control. Note that undo_marker is not reset s.t. the packets that were incorrectly marked lost would be corrected. We only avoid undoing the cwnd in tcp_undo_cwnd_reduction().

Quoted 4 lines

Applied and queued up for -stable, thanks!