mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tung Quang Nguyen <tung.quang.nguyen@est.tech>
To: Kyuwon Cho <kyuwoncho18@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"tipc-discussion@lists.sourceforge.net"
	<tipc-discussion@lists.sourceforge.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jon Maloy <jmaloy@redhat.com>
Subject: RE: [PATCH net] tipc: drop discovery messages shorter than the fields they carry
Date: Wed, 25 Nov 2026 09:44:59 +0000	[thread overview]
Message-ID: <AM7P189MB1137AEF136434E219D4075C3C6432@AM7P189MB1137.EURP189.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <179550610427.774194.2378040347436778640@gmail.com>

>Subject: [PATCH net] tipc: drop discovery messages shorter than the fields they
>carry
>
>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:

Discovery message's  header size (MAX_H_SIZE == 60) is stated in tipc_disc_init_msg() and it is a protocol message. 
How can the peer send a discovery message with a 24-byte header ?

>
>  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 ||

As sashiko pointed out, the lecacy node (before commit 948fa2d115c5 ("tipc: increase size of tipc discovery
messages") sends 40-byte header. The above check will drop that discovery message. This breaks our compatibility rule.

---
pw-bot: cr


      parent reply	other threads:[~2026-11-25  9:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  7:52 Kyuwon Cho
2026-11-25  8:21 ` netdev-bot+sashiko
2026-11-25  9:44 ` Tung Quang Nguyen [this message]

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=AM7P189MB1137AEF136434E219D4075C3C6432@AM7P189MB1137.EURP189.PROD.OUTLOOK.COM \
    --to=tung.quang.nguyen@est.tech \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jmaloy@redhat.com \
    --cc=kuba@kernel.org \
    --cc=kyuwoncho18@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tipc-discussion@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®