From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796334712; b=ugIm16dlqpXF/C8NSDnl0CzkWTmy2xVMInEkv5mucT/gUAYY3ly2vJfjaofA78Pg5Rny woZPw60hUCE7qwf8byHqWpxuDvlnB89NcnRoo6n2cp5u2hqRU+1r3QHv/RMVjB8XYsctm rWqaLdfhcfsPqhCJr4uIgZ+b6dRXcnhEflN9SnIyBJqOHeusvUrpYmxLset0H2E8dlaTW +CEZ1KeDBuUqTA2xACh8pzVzrJqvWAdSwCzwh2Lx/Hxd/t12ofGijoUGvJJCBP6XGw7v8 6JC9c7deQC4GRwwT/i5m98ERK9ZZxt+YCgGyucBK7PHH0XX35ZEj/XBXG6VLx/mHQ4A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796334712; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=Q2Exe6TuJDM84IK9EGyN85jWXFkFhrYOg/etIqpqWsA=; b=zsRmzC18Bww1tjwp4v6lwxI5nJRmJ0PBHELwDcNKYs/S/THlnEiIMVP+iQj0hPGXiq/z SZfPtwMXRNaaQkmhZpYUnyxWAhoEPFhhzvItuQ86BJHznTc3mz2IEx5QB6gCrerOtE+u8 WND8CNssgN2FZxX5CdBVNdJCTEELg0N9XWAxhoGnIyCF8wSeyULWVIzSRpNECiydaFw4y Kfaq5BOLMu45fLDfTfh8MDYJIs72/BGGcQDMpv9u3aICQe0F50l+9cRVcxH9wGgoW8QVH /xdSHCEMcmr3h0XPsF4Krl2c/asvJc2AlVureoE6rrzuSnTq+rN1Z4Kz2/jApHxsyWQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=l8+Irv6K; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EAB1606A33A; Thu, 3 Dec 2026 21:51:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=l8+Irv6K Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC10B1F000C2; Thu, 3 Dec 2026 21:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796334711; bh=Q2Exe6TuJDM84IK9EGyN85jWXFkFhrYOg/etIqpqWsA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=l8+Irv6KlB1C/NQhad18E2jGEVbD/saGlLRS/Y84mMTG18uqS4+5VX53NO/QahOou v/KunRN4F1LqjBJHR4StqXB1+USMnSoZtlU65nkL4LEM4qDt4sl30Hbxee2GKd/q1V lb9lCBg4BpvsaBkaYzNmxPwmM5KmxDABW2/gQfTDJjoOkAfoZL7kN6fLH+m4tnpjRj 20tUWYM2F+aFyM4QwcX5tB6PDS1XesuAxMvAx8FUUEFXGjro3TpZZhp2EdIbmUwAhP HYMxRyghdg6VR5zaUZG1+5jH/v0PKkaoBZtF29vU5C1RR/HBEEmeHPojfIabRkCHL8 FBAcZIGN4Lz4Q== Subject: Re: [PATCH net 3/9] mptcp: limit an orphan probing a zero window 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 Date: Thu, 03 Dec 2026 21:51:50 +0000 Message-ID: <179633471049.3146.15947480918525815086@kernel.org> In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-3-9f03efcb1a17@kernel.org> References: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-3-9f03efcb1a17@kernel.org> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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