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=1796433108; b=ptvZQugVou2TYyogZTsnr/RxyUgU50U0Lm9dBbWkfEoITLliPQ/XWFL4OO9nQ3ZDZp1n E0Nxj5IRkv3oqvP65rE14lXwj6YyTiLsV9LypvN69xGJtaPC6FYHgmVzpZ4vGbTWPH7rl L7li9NpjZZjMAxTetGHkWQkCM8e9Hz1/rczFi4F5XmrBhx1DWD/hjJNeROYVoLF5+rNbI PTIx8zT9wN6ZxDqDlmO+4phgy4xeyJAlMiNRp56GVVEWnhRvwEWhx2OyraEG03io7KTes j10u38uwov6GNgRKB0VZPzm6tmsBSyXZSsZDlNoHi2yqAyLAhqhUM5U9VeRRC4G8buA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796433108; 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=0j7OKRm1a3hdwUxIDvkKhYLi+YmzwrSgzE+ngJyyW4g=; b=U1GVjMxEDFh2dQEJGqP3Feqyea0O3/HhpqX754YeCawckabkS2WRTuLBPm7CseSR2sG9 Wkk7lD3cqDmM3JtHGOHoKV9A8GZSxlOkQ7bVny0hq4adKm7mwtFgHVkkVJOBO0eYu0sAC BxmMdIbvRRjcmJZtM27j3WQRQ0h2K4TtYt3CxdHlZ5/G84koPmeji8R97qpG6+ioRFJDt EAO6+IkNKM7T7PSGDc3Baa3drsHvAV/8s6vtO1M1DvbXt5sL70v/dX8yZalnNuQ9I8SzY KXMkLSc19aylSbv3QH5/FlOBsrhPBJp+Z1otxh1NwgxiuQ2quK/a2340/fwkLLw6KFg== 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=IzFm1jgB; 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 5A719606A332 for ; Sat, 5 Dec 2026 01:11:48 +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=IzFm1jgB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59F8E1F0092B; Sat, 5 Dec 2026 01:11:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796433107; bh=0j7OKRm1a3hdwUxIDvkKhYLi+YmzwrSgzE+ngJyyW4g=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=IzFm1jgBprYMhvF3Z4SMhViv2iOxn4YTcNyYJh977CAbz06ySr+5OqYIThEp5lrBT qZbRMZowNaN7xZBBqNVxo4icD1Oglimi0PkjfPjGVL445FOrnNNWPXIcSUX0c/rwGl PpD6M74/VwifOPpNHhSJTlIRiJafDjwPx36oX/9WnYULtDfDY3U6OTkq8W0TEHnYZ9 kKrszQo9JJ5uKlEvnB00AqnBLhkw1DDAzncVlOmBoNOxcR52tKeWAVTX/WrPX5kucG Wzvth3pBbLk1mlxy+ze+XY72AmJTxNGOVx8AYLK7HYvX0pi42ICsu9d1OyyohXZlQK 48HqMIieeEnoQ== Subject: Re: [PATCH net v2 2/2] tipc: reject SYN sent from a connection-oriented socket to a datagram server From: netdev-bot+sashiko@kernel.org To: tung.quang.nguyen@est.tech Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, edumazet@kernel.org, pabeni@redhat.com, jmaloy@redhat.com, horms@kernel.org, tipc-discussion@lists.sourceforge.net, willemb@google.com, astellman@stellman-greene.com Date: Sat, 05 Dec 2026 01:11:46 +0000 Message-ID: <179643310693.3146.4275269356282190125@kernel.org> In-Reply-To: <20261204003240.63452-3-tung.quang.nguyen@est.tech> References: <20261204003240.63452-3-tung.quang.nguyen@est.tech> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@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 1 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 0 · 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] This patch has no effect: a datagram server still accepts the SYN that the commit message says it rejects. -- tipc: reject SYN sent from a connection-oriented socket to a datagram server The patch tries to make a connectionless (SOCK_RDM/SOCK_DGRAM) TIPC server socket reject SYN or implicit-connect messages from connection-oriented clients with TIPC_ERR_NO_PORT. To do this it adds a clause to the receive filter in tipc_sk_filter_rcv(). Closes: https://lore.kernel.org/netdev/20261129144901.90934-1-bugs@stellman-greene.com/ > diff --git a/net/tipc/socket.c b/net/tipc/socket.c > index 4ed895b75bf3a..e606954fbd2c3 100644 > --- a/net/tipc/socket.c > +++ b/net/tipc/socket.c > @@ -2379,6 +2379,8 @@ static void tipc_sk_filter_rcv(struct sock *sk, struct sk_buff *skb, > hdr = buf_msg(skb); > limit = rcvbuf_limit(sk, skb); > if ((sk_conn && !tipc_sk_filter_connect(tsk, skb, xmitq)) || > + (!sk_conn && msg_connected(hdr) && > + (mtyp == TIPC_NAMED_MSG || mtyp == TIPC_DIRECT_MSG)) || > (!sk_conn && msg_connected(hdr)) || [Severity: High] Can this new clause ever be true for a SYN? msg_connected() only checks the message type: net/tipc/msg.h: static inline u32 msg_connected(struct tipc_msg *m) { return msg_type(m) == TIPC_CONN_MSG; } The SYN built by __tipc_sendmsg() is never a TIPC_CONN_MSG. It is a NAMED or DIRECT message with the SYN bit set: net/tipc/socket.c:__tipc_sendmsg() { ... msg_set_syn(hdr, 1); ... if (atype == TIPC_SERVICE_ADDR) { msg_set_type(hdr, TIPC_NAMED_MSG); ... } else { /* TIPC_SOCKET_ADDR */ msg_set_type(hdr, TIPC_DIRECT_MSG); ... } So msg_connected(hdr) is false for every SYN, and the new clause is false too. Whenever the new clause is true, the unchanged line after it is also true: (!sk_conn && msg_connected(hdr)) As a result, the set of rejected messages looks the same as before the patch. A SOCK_RDM or SOCK_DGRAM server would still add the SYN-flagged NAMED/DIRECT message to sk_receive_queue. Would the reproducer in the commit message still show the problem? There is a second issue with the clause. mtyp is read once, from the first skb, before the dequeue loop: int mtyp = msg_type(hdr); The loop never reads it again for the skb it is checking. Was the intent to test msg_is_syn(hdr), together with a type check on the current skb's header? The type check matters because tipc_mcast_send_sync() in net/tipc/bcast.c also sets the SYN bit, on TIPC_MCAST_MSG headers that connectionless sockets legitimately receive: /* Preparing for 'synching' header */ msg_set_syn(hdr, 1); A plain !sk_conn && msg_is_syn(hdr) test would also reject that multicast traffic. > (!grp && msg_in_group(hdr))) > err = TIPC_ERR_NO_PORT; -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204003240.63452-1-tung.quang.nguyen%40est.tech