Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: matttbe@kernel.org
Cc: martineau@kernel.org, geliang@kernel.org, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	willemb@google.com, horms@kernel.org, dcaratti@redhat.com,
	netdev@vger.kernel.org, mptcp@lists.linux.dev, mason@kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH net 3/9] mptcp: limit an orphan probing a zero window
Date: Thu, 03 Dec 2026 21:51:50 +0000	[thread overview]
Message-ID: <179633471049.3146.15947480918525815086@kernel.org> (raw)
In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-3-9f03efcb1a17@kernel.org>

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 2 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] mptcp_orphan_keep() keeps the orphan as long as any active
  subflow has a fresh rcv_tstamp and mptcp_subflow_probe_timed_out()…
- [Medium] In mptcp_subflow_probe_timed_out() (net/mptcp/protocol.c), the
  data-in-flight branch decides only on `!tp->snd_wnd && icsk->icsk_rto…
- [Medium] The orphan keep logic (mptcp_orphan_keep() plus
  mptcp_subflow_probe_timed_out() in net/mptcp/protocol.c) only looks at…

--

mptcp: limit an orphan probing a zero window

This patch adds mptcp_subflow_probe_timed_out(). It checks whether TCP
would have aborted a subflow if that subflow were an orphan probing a
zero window. mptcp_orphan_keep() now uses it, so a peer that keeps its
window closed can no longer hold an MPTCP orphan forever.

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 82a0cbe38192e..96b3baef341f3 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2814,6 +2814,32 @@ static bool mptcp_close_tout_expired(const struct sock *sk)
>  		  inet_csk(sk)->icsk_mtup.probe_timestamp + mptcp_close_timeout(sk));
>  }
>  
> +/* Would TCP abort this subflow if it were an orphan probing a zero window? */
> +static bool mptcp_subflow_probe_timed_out(struct sock *ssk)
> +{

[ ... ]

> +	slow = lock_sock_fast_nested(ssk);
> +	limit = tcp_rto_max(ssk);
> +	if (tp->packets_out) {
> +		ret = !tp->snd_wnd && icsk->icsk_rto >= limit;

[Severity: Medium]
Can icsk_rto ever reach tcp_rto_max() here when
net.ipv4.tcp_thin_linear_timeouts=1?

Take a subflow with fewer than 4 packets in flight whose peer has shrunk
its window to zero. The subflow is not SOCK_DEAD, so
tcp_retransmit_timer() takes the zero-window branch. It jumps to
out_reset_timer without calling tcp_update_rto_stats():

net/ipv4/tcp_timer.c:tcp_retransmit_timer() {
    ...
	if (!tp->snd_wnd && !sock_flag(sk, SOCK_DEAD) &&
	    !((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))) {
		...
		tcp_enter_loss(sk);
		tcp_retransmit_skb(sk, skb, 1);
		__sk_dst_reset(sk);
		goto out_reset_timer;
	}
    ...
out_reset_timer:
	...
	if (sk->sk_state == TCP_ESTABLISHED &&
	    (tp->thin_lto || READ_ONCE(net->ipv4.sysctl_tcp_thin_linear_timeouts)) &&
	    tcp_stream_is_thin(tp) &&
	    icsk->icsk_retransmits <= TCP_THIN_LINEAR_RETRIES) {
		icsk->icsk_backoff = 0;
		icsk->icsk_rto = clamp(__tcp_set_rto(tp),
				       tcp_rto_min(sk),
				       tcp_rto_max(sk));
    ...
}

Because icsk_retransmits stays at 0, the thin-stream branch runs every
time the timer fires. It recomputes icsk_rto from srtt/rttvar, so this
check never returns true.

The peer's dup ACKs keep rcv_tstamp fresh, so
tcp_rtx_probe0_timed_out() does not abort the subflow either. As a
result, mptcp_worker() keeps re-arming the close timeout through
mptcp_start_tout_timer().

A plain TCP orphan in the same state is SOCK_DEAD, so it skips that
branch, goes through tcp_write_timeout(), and is aborted.

The commit message says this case is covered ("Same with data in
flight, when the peer has shrunk its window to zero"). This setting is
not one of the corner cases it lists.

Only the per-netns sysctl can trigger this, because
TCP_THIN_LINEAR_TIMEOUTS cannot be set on an MPTCP socket. The only
bound is the global tcp_check_oom() limit added later in the series by
"mptcp: count orphans as TCP does".

> +	} else {
> +		if (icsk->icsk_backoff < retries2)
> +			limit *= 2;
> +		/* a shift of 32 already exceeds the limit */
> +		when = (u64)icsk->icsk_rto << min_t(u8, icsk->icsk_backoff, 32);
> +		ret = tcp_send_head(ssk) && when >= limit;

[Severity: High]
For an idle subflow with packets_out == 0 and no send head, this always
returns false. With default settings, could a remote peer use a second,
idle backup subflow to keep the orphan forever?

The sequence would be:

1. The peer opens a second subflow B with MP_JOIN and sets the backup
   bit, which subflow_check_req() copies into subflow->backup. The peer
   could also mark B as backup later with MP_PRIO.

2. The peer keeps its window at zero, so the zero-window probe sits on
   subflow A. With this patch, A is eventually reported as timed out.

3. The peer sends a pure in-window ACK on B more often than every 240s,
   so tcp_ack() keeps B's rcv_tstamp fresh.

B never gets any data:

- mptcp_subflow_get_send() does not pick a backup subflow while A is
  active.
- There is no rtx head, since snd_una == snd_nxt.
- mptcp_subflow_get_retrans() only returns a backup when
  min_stale_count > 1.

Stale detection does not help either. mptcp_pm_chk_stale() skips B:

net/mptcp/pm.c:mptcp_pm_chk_stale() {
    ...
		/* No data outstanding at TCP level? not stale */
		if (tcp_rtx_and_write_queues_empty(ssk))
			continue;
    ...
}

A is never marked stale because its rcv_tstamp keeps changing.

mptcp_orphan_keep() then returns true through B every time the close
timeout expires, and mptcp_worker() re-arms the timer.

The commit message says:

    an idle subflow refreshed by keepalives still keeps the orphan
    when the stale detection is disabled

Is that accurate, given that this case needs no non-default setting?

A non-backup idle subflow does not stay idle, because
__mptcp_push_pending() would queue a probe on it. The backup bit is what
keeps B idle.

This is still present at the end of the series. Only the
tcp_check_oom() limit from "mptcp: count orphans as TCP does" bounds it.

Would it make sense to count only subflows that hold data, or to track
MPTCP-level progress instead?

> +	}
> +	unlock_sock_fast(ssk, slow);
> +
> +	return ret;
> +}

[ ... ]

> @@ -2829,7 +2855,8 @@ static bool mptcp_orphan_keep(struct sock *sk)
>  		/* a live peer acks at least the probes, every TCP_RTO_MAX */
>  		if (__mptcp_subflow_active(subflow) &&
>  		    tcp_jiffies32 - READ_ONCE(tcp_sk(ssk)->rcv_tstamp) <
> -		    2 * TCP_RTO_MAX)
> +		    2 * TCP_RTO_MAX &&
> +		    !mptcp_subflow_probe_timed_out(ssk))
>  			return true;
>  	}

[Severity: Medium]
Should this also check MPTCP-level progress? The keep decision only
looks at TCP-level subflow state: rcv_tstamp, packets_out, snd_wnd,
icsk_rto, icsk_backoff and the send head. Nothing checks whether
msk->snd_una has advanced.

A peer could advertise a non-zero TCP window, TCP-ACK every segment,
and never advance DATA_ACK.

ack_update_msk() only moves wnd_end forward, so the msk stops sending
new data once snd_nxt reaches wnd_end. mptcp_sendmsg_frag() then sends
no zero-window probe because snd_una != snd_nxt. At the same time,
snd_nxt != write_seq still holds.

__mptcp_retrans() has no retry limit and always ends with:

reset_timer:
	mptcp_check_and_set_pending(sk);

	if (!mptcp_rtx_timer_pending(sk))
		mptcp_reset_rtx_timer(sk);

The dfrag therefore keeps being retransmitted on a subflow with empty
TCP queues. The peer TCP-ACKs it, so rcv_tstamp stays fresh.

Both branches of mptcp_subflow_probe_timed_out() then return false:

- With packets_out set, snd_wnd is non-zero.
- Without packets_out, there is no send head.

Wouldn't mptcp_orphan_keep() then return true every time the close
timeout expires? That would pin the orphan forever, with a single
subflow and default settings.

This needs a misbehaving peer that withholds DATA_ACK while still
sending TCP ACKs. A Linux peer that stops reading advances DATA_ACK and
closes its window instead.

The keep logic came from the previous commit, "mptcp: keep an orphan
while it can send its data". The only limit is the global
tcp_check_oom() bound added later in the series.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-net-mptcp-misc-fixes-7-4-rc7-v1-0-9f03efcb1a17%40kernel.org

  reply	other threads:[~2026-12-03 21:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 21:29 [PATCH net 0/9] mptcp: misc fixes for v7.4-rc7 Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 1/9] mptcp: pm: kernel: c-flag: keep local_addr_used in sync Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 2/9] mptcp: keep an orphan while it can send its data Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 3/9] mptcp: limit an orphan probing a zero window Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko [this message]
2026-12-02 21:29 ` [PATCH net 4/9] mptcp: count orphans as TCP does Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 5/9] mptcp: return EOF after a DATA_FIN, " Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 6/9] mptcp: wake up blocked senders when no sf left Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 7/9] mptcp: reclaim forward memory after coalescing skbs Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 8/9] mptcp: don't charge a shared page twice at accept() Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 9/9] mptcp: don't charge the backlog " Matthieu Baerts (NGI0)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179633471049.3146.15947480918525815086@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=edumazet@kernel.org \
    --cc=geliang@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=martineau@kernel.org \
    --cc=mason@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox