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=1796334713; b=dyKscCT+MXnU4jwwP3e+rdZQDZKQYNiG0i0hFf3Xu57nR3IWjk1xu1tUH4nzcgqGz/pz TyHU6B4JOmj6e+y9j+menKhtbBNDrCQBJ+uUh3WslgX1J2LzxFO1nhpzWy01JG9P6PlU9 71FPuTORqdLTaXkTmt3xm5MxST6AiOZgz8+nSkAOF/e5hXhlDNgkS/ybzKwoo5yoc7SXI ugP9QIwLgXuNl39xHaZ3544VrT6ZuIEsFC1BoudOtK9nxhpJQGqiBJNpuLzOLZGPHNTwW qppXYrnAi3Is+jXWyrYxGCqwes9KKvIdOsdxB7ZaoAjwMtreZ+n5ROt3RhPf4fKPzbg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796334713; 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=B2ynsbDLc0ctCKqac6w4btSpcFUbh0gFdloh9+eFNWg=; b=xcSVU31IO1j+yVbJS7m5VBXCR2l6hjeAAfTEMXgUg5Ykn/hkORX0lBLWnx6eFhkTKhKQ Ry5TXXzw0wN2c7x1zeXnEi37jCARH7OORIAwZ2G3kgRS3WN5BZxsJLZ5n6T9w2sXHBbI4 yNgAIemRnG+zJkEwEvGJpKCoikKEhvNFhcRrn4kc191fCySHmWs7YXft+eJ9oRX4B375V LsJladZEUPjOuSZy3r9JY5V//K5Apdz/CLi9brkn/lONOnmRBv6/5tnYR4TtC2OF/Itq+ fmREViWl5U44LCVz56i2P5IWz+A2JoMS+h57htg/xk42xUyW5ped49ePUmuQFsSoBzA== 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=QtY4eq+K; 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 5D629606A687; Thu, 3 Dec 2026 21:51:53 +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=QtY4eq+K Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54F071F00933; Thu, 3 Dec 2026 21:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796334713; bh=B2ynsbDLc0ctCKqac6w4btSpcFUbh0gFdloh9+eFNWg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=QtY4eq+KjfZl4zJCc4gjlsyrAJKUBl6FDUf3u5C5CGTgaPx+OiAOcRuw6/hsizyhc KDCb0JwBZHHkIkGR46XKtomwH0Seh/5M5ANbk4yoab4EB5csorCELykvi/1lkiqBcm Oav5yezGLmYZ7kSQPr6qonEdMrXERmzIOpgTrJzRokrc6I5N9zo/oSTE9tfbeIDUf5 LZXYerm4qR+ToeXZVYNGBT9RNlAt1QHjo0eS7U4JzgnasJILN4c2VUU6beFRM4i/Dw 1pWl4KoWEhQB0bQEjuw80nSXHYlPCpeagCSpC+JS04zEIOrdCXGrwIi5sTQTuekdY8 PxTyYpTiqf8ng== Subject: Re: [PATCH net 4/9] mptcp: count orphans as TCP does 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:51 +0000 Message-ID: <179633471192.3146.8810228234232955911@kernel.org> In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-4-9f03efcb1a17@kernel.org> References: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-4-9f03efcb1a17@kernel.org> X-sashiko-severity: Medium 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 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 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). - [Medium] For fallback MPTCP connections, the new OOM abort at close() does not reset the connection. - [Low] The MIB counter and the RST reason disagree for the new MPTCP OOM abort. -- mptcp: count orphans as TCP does This commit adds MPTCP sockets orphaned by close() to tcp_orphan_count. That way tcp_max_orphans and the TCP memory limits apply to them. If tcp_check_oom() reports too many orphans or too much memory, the orphan is reset at close() or when its close timeout expires, and the abort is counted in TCPAbortOnMemory. > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c > index 96b3baef341f3..fc8aad7e2fde9 100644 > --- a/net/mptcp/protocol.c > +++ b/net/mptcp/protocol.c > @@ -2840,6 +2840,16 @@ static bool mptcp_subflow_probe_timed_out(struct sock *ssk) > return ret; > } > > +/* As TCP orphans: limited in number and memory */ > +static bool mptcp_orphan_oom(struct sock *sk) > +{ > + if (!tcp_check_oom(sk, 0)) > + return false; > + > + NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONMEMORY); > + return true; > +} [Severity: Low] Should the reset sent for this abort use SK_RST_REASON_TCP_ABORT_ON_MEMORY? Both new abort paths end up in mptcp_do_fastclose(). One is a direct call from __mptcp_close(). The other is from mptcp_worker() once mptcp_orphan_keep() returns false. mptcp_do_fastclose() hard-codes the close reason: net/mptcp/protocol.c:mptcp_do_fastclose() { ... tcp_send_active_reset(ssk, SK_RST_REASON_TCP_ABORT_ON_CLOSE); ... } include/net/rstreason.h pairs SK_RST_REASON_TCP_ABORT_ON_MEMORY with LINUX_MIB_TCPABORTONMEMORY, and __tcp_close() uses the two together: if (tcp_check_oom(sk, 0)) { tcp_set_state(sk, TCP_CLOSE); tcp_send_active_reset(sk, SK_RST_REASON_TCP_ABORT_ON_MEMORY); __NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONMEMORY); With this patch, a non-fallback MPTCP OOM abort is counted in TCPAbortOnMemory, but the tcp_send_reset tracepoint reports ABORT_ON_CLOSE for it. The hard-coded reason was already there, but this patch is the first to use it for memory aborts. [ ... ] > @@ -3579,8 +3592,15 @@ bool __mptcp_close(struct sock *sk, long timeout) > /* all the subflows are closed, only timeout can change the msk > * state, let's not keep resources busy for no reasons > */ > - if (subflows_alive == 0) > + if (subflows_alive == 0) { > mptcp_set_state(sk, TCP_CLOSE); > + } else if (sk->sk_state != TCP_CLOSE) { > + /* as TCP orphans: counted, and limited */ > + tcp_orphan_count_inc(); > + set_bit(MPTCP_ORPHAN_COUNTED, &msk->flags); > + if (mptcp_orphan_oom(sk)) > + mptcp_do_fastclose(sk); > + } [Severity: Medium] Does this branch reset the connection when the msk has fallen back to TCP? On fallback sockets, mptcp_do_fastclose() sets TCP_CLOSE and returns before it sends any RST: /* Explicitly send the fastclose reset as need */ if (__mptcp_check_fallback(msk)) return; So subflow->send_fastclose stays 0. Since the msk is now TCP_CLOSE, the destroy path runs right away: __mptcp_close() __mptcp_destroy_sock() mptcp_destroy() /* sets free_first */ mptcp_destroy_common() __mptcp_clear_xmit(sk) /* drops unsent msk-level data */ __mptcp_close_ssk(sk, ssk, subflow, 0) __tcp_close(ssk, 0) /* dispose_it is true */ If close() ran with data still pending at the msk level, mptcp_check_send_data_fin() returned early. The subflow is therefore still ESTABLISHED, and __tcp_close() sends a normal FIN on it. A RST follows only if TCP's own tcp_check_oom(ssk, 0) in __tcp_close() also fires. In the orphan-limit case, both checks read the same cached orphan count. TCP then resets as well, and TCPAbortOnMemory is incremented a second time for the same connection. In the memory case, tcp_out_of_memory() checks the subflow's sk_wmem_queued against SOCK_MIN_SNDBUF. That value can be small while the msk's queue is large, for example when msk-to-subflow pushes fail under tcp_mem[2] pressure. Can the peer then get a clean FIN after __mptcp_clear_xmit() has silently dropped the rest of the stream? The close timeout path in mptcp_worker() handles the same fallback socket differently. There, free_first is still 0, so __mptcp_close_ssk() goes through __mptcp_subflow_disconnect() and tcp_disconnect(), which sends a RST. The commit message says: reset an orphan when there are too many orphans, or when TCP uses too much memory: at close(), and when its close timeout expires Should the fallback case get an explicit reset here, with TCPAbortOnMemory counted only once? Later patches in this series don't seem to change mptcp_do_fastclose(), mptcp_orphan_oom() or this branch of __mptcp_close(). -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-net-mptcp-misc-fixes-7-4-rc7-v1-0-9f03efcb1a17%40kernel.org