From: Kyuwon Cho <kyuwoncho18@gmail.com>
To: Jon Maloy <jmaloy@redhat.com>,
Tung Quang Nguyen <tung.quang.nguyen@est.tech>
Cc: Ying Xue <ying.xue@windriver.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: [PATCH net] tipc: drop discovery messages shorter than the fields they carry
Date: Tue, 24 Nov 2026 16:52:46 +0900 [thread overview]
Message-ID: <179550610427.774194.2378040347436778640@gmail.com> (raw)
tipc_disc_rcv() reads the media address and words 13 and 14 of a full
MAX_H_SIZE header, and the 128-bit node identity from the data after
it, but tipc_msg_validate() only checks that the declared header is at
least MIN_H_SIZE. A peer on the bearer can send a discovery message
with a 24-byte header, and those fields are then read from past the end
of the message. For a UDP bearer, tipc_udp_msg2addr() takes the peer's
address from there:
BUG: KMSAN: uninit-value in tipc_udp_msg2addr (net/tipc/udp_media.c:129)
tipc_udp_msg2addr (net/tipc/udp_media.c:129 net/tipc/udp_media.c:159)
tipc_disc_rcv (net/tipc/discover.c:227)
tipc_rcv (net/tipc/node.c:2136)
tipc_udp_recv (net/tipc/udp_media.c:389)
udp_queue_rcv_one_skb (net/ipv4/udp.c:2433)
udp_queue_rcv_skb (net/ipv4/udp.c:2473)
Uninit was created at:
kmem_cache_alloc_node_noprof (mm/slub.c:5105)
__alloc_skb (net/core/skbuff.c:616 net/core/skbuff.c:716)
Discovery messages have been sent with a MAX_H_SIZE header since commit
948fa2d115c5 ("tipc: increase size of tipc discovery messages"), and
with the node identity after it when TIPC_NODE_ID128 is set. Drop the
shorter ones.
Fixes: b97bf3fd8f6a ("[TIPC] Initial merge")
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: as an unprivileged user in its own
user and network namespace, it enables a UDP bearer and sends it a
discovery message with a 24-byte header. KASAN stays quiet, as the
bytes read are in the skb's tailroom; KMSAN reports them as above, and
the kernel logs "Rcv corrupt discovery message" for the address built
from them.
The patch was written with LLM assistance; we reviewed and tested it.
With it, the short message is dropped without KMSAN reports, and two
namespaces joined by a veth pair with UDP bearers still discover each
other and bring the link up.
net/tipc/discover.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index b9d06595b067..0f99e4af1cfa 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -219,6 +219,12 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *skb,
}
hdr = buf_msg(skb);
+ if (msg_hdr_sz(hdr) < MAX_H_SIZE ||
+ ((caps & TIPC_NODE_ID128) && msg_data_sz(hdr) < NODE_ID_LEN)) {
+ kfree_skb(skb);
+ return;
+ }
+
if (caps & TIPC_NODE_ID128)
memcpy(peer_id, msg_node_id(hdr), NODE_ID_LEN);
else
--
2.43.0
reply other threads:[~2026-11-24 7:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179550610427.774194.2378040347436778640@gmail.com \
--to=kyuwoncho18@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=tung.quang.nguyen@est.tech \
--cc=willemb@google.com \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox