Netdev List
 help / color / mirror / Atom feed
* [PATCH net] tipc: don't set SYN on multicast from connection-oriented sockets
@ 2026-11-29 14:49 Andrew Stellman
  2026-11-30 16:01 ` Tung Quang Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Stellman @ 2026-11-29 14:49 UTC (permalink / raw)
  To: Jon Maloy, Tung Quang Nguyen
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev, tipc-discussion, linux-kernel

From: Andrew Stellman <astellman@stellman-greene.com>

__tipc_sendmsg() sets the SYN bit on every message sent from an
unconnected SEQPACKET or STREAM socket, including messages sent to a
service range, which go out as multicast. A range send doesn't connect
the socket, so every range send from it carries SYN.

Since commit c55c8edafa91 ("tipc: smooth change between replicast and
broadcast"), multicast receivers treat SYN as the marker for a switch
between replicast and broadcast: tipc_mcast_filter_msg() puts a SYN
message in the receiving socket's deferred queue until its twin
arrives by the other method. tipc_mcast_xmit() sends a twin only when
the sending socket switches method. The first range send from a new
socket can get one, because it switches from the default method. A
later range send that doesn't switch method has no twin, so a remote
receiver defers it instead of delivering it.

Don't set SYN when the destination is a service range. Connection
setup to a service or socket address still sets it. This changes
existing behaviour: range sends from these sockets no longer carry
SYN, so remote receivers deliver the ones they used to defer.

Tested on net-next (f89726ffabef) in arm64 QEMU with KASAN, with two
TIPC nodes in network namespaces linked by veth, an unprivileged
sender and RDM receivers with a 3-second receive timeout. Each socket
made two range sends. Without this patch, in each of five runs, the
remote receiver got the first range send from the SEQPACKET socket
and the first from the STREAM socket, but not the second from either.
With it, in each of two runs, it got all four. RDM multicast and a
SEQPACKET unicast were received in every run, and KASAN reported
nothing.

Fixes: c55c8edafa91 ("tipc: smooth change between replicast and broadcast")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
The issue was found by Claude Opus 5.5 running Quality Playbook, an
LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with
Claude Opus 5.5, and both were reviewed by me.

SYN has been set on these sends since commit 25b9221b9594 ("tipc: add
SYN bit to connection setup messages"), but multicast receivers act
on it only since c55c8edafa91, so that's the Fixes target.
net/tipc/socket.c is identical in net (28a371228d4e), net-next
(f89726ffabef) and mainline (bb13fcd7f438).

A reproducer is available on request.

 net/tipc/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 26771a98dc7a6..27af43bce0b11 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1460,7 +1460,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
 			return -EOPNOTSUPP;
 		if (atype == TIPC_SERVICE_ADDR)
 			tsk->conn_addrtype = atype;
-		msg_set_syn(hdr, 1);
+		msg_set_syn(hdr, atype != TIPC_SERVICE_RANGE);
 	}
 
 	memset(&skaddr, 0, sizeof(skaddr));
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tipc: don't set SYN on multicast from connection-oriented sockets
  2026-11-29 14:49 [PATCH net] tipc: don't set SYN on multicast from connection-oriented sockets Andrew Stellman
@ 2026-11-30 16:01 ` Tung Quang Nguyen
  2026-11-30 17:22   ` Andrew Stellman
  0 siblings, 1 reply; 3+ messages in thread
From: Tung Quang Nguyen @ 2026-11-30 16:01 UTC (permalink / raw)
  To: Andrew Stellman
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev@vger.kernel.org,
	tipc-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Jon Maloy

> __tipc_sendmsg() sets the SYN bit on every message sent from an
> unconnected SEQPACKET or STREAM socket, including messages sent to a
> service range, which go out as multicast. A range send doesn't connect
> the socket, so every range send from it carries SYN.

I do not understand above writing.
Can you demonstrate by using current code (what functions, what lines) ?

> Don't set SYN when the destination is a service range. Connection
> setup to a service or socket address still sets it. 

Can you demonstrate by using current code (what functions, what lines) ?

> Tested on net-next (f89726ffabef) in arm64 QEMU with KASAN, with two
> TIPC nodes in network namespaces linked by veth, an unprivileged
> sender and RDM receivers with a 3-second receive timeout. Each socket
> made two range sends. Without this patch, in each of five runs, the
> remote receiver got the first range send from the SEQPACKET socket
> and the first from the STREAM socket, but not the second from either.
> With it, in each of two runs, it got all four. RDM multicast and a
> SEQPACKET unicast were received in every run, and KASAN reported
> nothing.

Please show me what KASAN reported ?

> A reproducer is available on request.

Definitely. I need your reproducer to understand the problem.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] tipc: don't set SYN on multicast from connection-oriented sockets
  2026-11-30 16:01 ` Tung Quang Nguyen
@ 2026-11-30 17:22   ` Andrew Stellman
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Stellman @ 2026-11-30 17:22 UTC (permalink / raw)
  To: Tung Quang Nguyen
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev, tipc-discussion, linux-kernel, Jon Maloy

On Mon, Nov 30, 2026 at 04:01:57PM +0000, Tung Quang Nguyen wrote:
> I do not understand above writing.
> Can you demonstrate by using current code (what functions, what lines) ?

Sure, this is on net-next f89726ffabef. A SEQPACKET or STREAM socket
that isn't connected sends through __tipc_sendmsg() (for STREAM, via
tipc_sendstream()). For a connection-oriented socket, __tipc_sendmsg()
sets SYN in the socket's header at net/tipc/socket.c:1463,
msg_set_syn(hdr, 1), before it looks at the address type. For a
TIPC_SERVICE_RANGE destination it then calls tipc_sendmcast(), so the
multicast goes out with SYN set. A range send doesn't connect the
socket, so every later range send from it sets SYN again.

On the receiving node, tipc_sk_filter_rcv() hands the message to
tipc_mcast_filter_msg(), which puts a SYN message it can't match to a
sync message on mc_method.deferredq instead of the receive queue. In
my test the first range send from each socket got through, because
tipc_mcast_xmit() also sent a sync message (tipc_mcast_send_sync())
when it chose the multicast method. The second one had no matching
sync message and never reached the receiver.

> Can you demonstrate by using current code (what functions, what lines) ?

The patch changes that one line to
msg_set_syn(hdr, atype != TIPC_SERVICE_RANGE), so a range send no
longer sets SYN. TIPC_SERVICE_ADDR and TIPC_SOCKET_ADDR destinations
still set it, so connection setup doesn't change.

> Please show me what KASAN reported ?

Nothing. KASAN was enabled in the test kernel and didn't report
anything, with or without the patch. The problem isn't a memory error;
the second range send just never arrives at the remote receiver.

> Definitely. I need your reproducer to understand the problem.

I'll send it to you off-list.

Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-30 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 14:49 [PATCH net] tipc: don't set SYN on multicast from connection-oriented sockets Andrew Stellman
2026-11-30 16:01 ` Tung Quang Nguyen
2026-11-30 17:22   ` Andrew Stellman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox