Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Andrew Stellman
Sun, 29 Nov 2026 14:49
[PATCH net] tipc: don't set SYN on multicast from connection-oriented sockets
Author: Andrew Stellman
Date: Sun, 29 Nov 2026 14:49
Date: Sun, 29 Nov 2026 14:49
68 lines
14104 bytes
14104 bytes
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
Re: [PATCH net] tipc: don't set SYN on multicast from connection-oriented sockets
Author: Tung Quang Nguyen
Date: Mon, 30 Nov 2026 16:01
Date: Mon, 30 Nov 2026 16:01
29 lines
18955 bytes
18955 bytes
> __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.
Re: [PATCH net] tipc: don't set SYN on multicast from connection-oriented sockets
Author: Andrew Stellman
Date: Mon, 30 Nov 2026 17:22
Date: Mon, 30 Nov 2026 17:22
40 lines
13201 bytes
13201 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads