Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Kyuwon Cho
Wed, 25 Nov 2026 02:05
[PATCH net] tipc: initialize the whole connect retry delay
Author: Kyuwon Cho
Date: Wed, 25 Nov 2026 02:05
Date: Wed, 25 Nov 2026 02:05
82 lines
13388 bytes
13388 bytes
When a connecting socket gets TIPC_ERR_OVERLOAD and still has its SYN,
tipc_sk_filter_connect() schedules a retry after a random delay:
get_random_bytes(&delay, 2);
...
delay %= (tsk->conn_timeout / 4);
delay is an unsigned long, so only two of its bytes are random and the
rest are whatever was on the stack:
BUG: KMSAN: uninit-value in tipc_sk_filter_rcv (net/tipc/socket.c:2244)
tipc_sk_filter_rcv (net/tipc/socket.c:2244 net/tipc/socket.c:2379)
tipc_sk_backlog_rcv (net/tipc/socket.c:2422)
__release_sock (net/core/sock.c:3344)
release_sock (net/core/sock.c:3941)
tipc_wait_for_connect (net/tipc/socket.c:2559)
tipc_connect (net/tipc/socket.c:2658)
__sys_connect (net/socket.c:2185)
Local variable delay.i created at:
tipc_sk_filter_rcv (net/tipc/socket.c:2207 net/tipc/socket.c:2379)
Use get_random_u16(), which gives the same range.
Fixes: 6787927475e5 ("tipc: buffer overflow handling in listener socket")
Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
---
The issue was found by an LLM-guided test generator that we are
developing as a research prototype. A reproducer, which runs as any
user:
#include <linux/tipc.h>
#include <sys/socket.h>
#include <unistd.h>
int main(void)
{
struct sockaddr_tipc a = {
.family = AF_TIPC,
.addrtype = TIPC_SERVICE_ADDR,
.scope = TIPC_NODE_SCOPE,
.addr.name.name = { .type = 18888, .instance = 1 },
};
int srv = socket(AF_TIPC, SOCK_STREAM, 0), rcvbuf = 1024, tmo = 3;
/* a listener that is overloaded at once */
setsockopt(srv, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf));
bind(srv, (void *)&a, sizeof(a));
listen(srv, 0);
for (int i = 0; i < 96; i++) {
int fd = socket(AF_TIPC, SOCK_STREAM, 0);
setsockopt(fd, SOL_TIPC, TIPC_CONN_TIMEOUT, &tmo, sizeof(tmo));
connect(fd, (void *)&a, sizeof(a));
}
sleep(1);
return 0;
}
Without the patch, KMSAN reports the uninit-value above during the
connects; with it, it does not.
The patch was written with LLM assistance; we reviewed and tested it.
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 65cc0c4964b3..e84168b29df9 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -2237,7 +2237,7 @@ static bool tipc_sk_filter_connect(struct tipc_sock *tsk, struct sk_buff *skb,
/* Prepare for new setup attempt if we have a SYN clone */
if (skb_queue_empty(&sk->sk_write_queue))
break;
- get_random_bytes(&delay, 2);
+ delay = get_random_u16();
if (tsk->conn_timeout < 4)
tsk->conn_timeout = 4;
delay %= (tsk->conn_timeout / 4);
--
2.43.0
RE: [PATCH net] tipc: initialize the whole connect retry delay
Author: Tung Quang Nguyen
Date: Thu, 26 Nov 2026 08:31
Date: Thu, 26 Nov 2026 08:31
31 lines
18310 bytes
18310 bytes
>Subject: [PATCH net] tipc: initialize the whole connect retry delay
>
>When a connecting socket gets TIPC_ERR_OVERLOAD and still has its SYN,
>tipc_sk_filter_connect() schedules a retry after a random delay:
>
> get_random_bytes(&delay, 2);
> ...
> delay %= (tsk->conn_timeout / 4);
>
>delay is an unsigned long, so only two of its bytes are random and the rest are
>whatever was on the stack:
>
> BUG: KMSAN: uninit-value in tipc_sk_filter_rcv (net/tipc/socket.c:2244)
> tipc_sk_filter_rcv (net/tipc/socket.c:2244 net/tipc/socket.c:2379)
> tipc_sk_backlog_rcv (net/tipc/socket.c:2422)
> __release_sock (net/core/sock.c:3344)
> release_sock (net/core/sock.c:3941)
> tipc_wait_for_connect (net/tipc/socket.c:2559)
> tipc_connect (net/tipc/socket.c:2658)
> __sys_connect (net/socket.c:2185)
> Local variable delay.i created at:
> tipc_sk_filter_rcv (net/tipc/socket.c:2207 net/tipc/socket.c:2379)
>
>Use get_random_u16(), which gives the same range.
>
>Fixes: 6787927475e5 ("tipc: buffer overflow handling in listener socket")
>Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
Reviewed-by: Tung Nguyen <tung.quang.nguyen@est.tech>
Re: [PATCH net] tipc: initialize the whole connect retry delay
Author: patchwork-bot+netdevbpf
Date: Wed, 02 Dec 2026 02:40
Date: Wed, 02 Dec 2026 02:40
24 lines
8596 bytes
8596 bytes
Hello:
This patch was applied to netdev/net.git (main)
by Willem de Bruijn <willemb@google.com>:
On Wed, 25 Nov 2026 11:05:02 +0900 you wrote:
> When a connecting socket gets TIPC_ERR_OVERLOAD and still has its SYN,
> tipc_sk_filter_connect() schedules a retry after a random delay:
>
> get_random_bytes(&delay, 2);
> ...
> delay %= (tsk->conn_timeout / 4);
>
> [...]
Here is the summary with links:
- [net] tipc: initialize the whole connect retry delay
https://git.kernel.org/netdev/net/c/b978a3a745a6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
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