From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, dsahern@kernel.org, horms@kernel.org,
yoshfuji@linux-ipv6.org, Ido Schimmel <idosch@nvidia.com>,
stable@vger.kernel.org
Subject: [PATCH net 1/2] ipmr: fully initialize the synthetic IP header in ipmr_get_route()
Date: Sun, 25 Oct 2026 09:17:28 +0200 [thread overview]
Message-ID: <20261025071729.34967-2-idosch@nvidia.com> (raw)
In-Reply-To: <20261025071729.34967-1-idosch@nvidia.com>
For an unresolved multicast route query, ipmr_get_route() builds a
synthetic IP header in the headroom obtained from
skb_realloc_headroom(), which does not zero the memory it allocates.
Only a few fields are initialized, leaving others as stale heap
contents.
ipmr_cache_report() copies this header into the IGMPMSG_NOCACHE report
that is queued to the mroute socket, so a recvmsg() on that socket leaks
the uninitialized bytes to user space: the 'tos' field [1] and the 'id'
and 'frag_off' fields [2].
Fix by zeroing the IP header before filling in the few fields that are
used, so that the entire header is initialized, as in ip6mr_get_route().
[1]
BUG: KMSAN: kernel-infoleak in _copy_to_iter
raw_recvmsg
Uninit was stored to memory at:
ipmr_cache_report
ipmr_cache_unresolved
ipmr_get_route
Uninit was created at:
pskb_expand_head
skb_realloc_headroom
ipmr_get_route
Byte 1 of 28 is uninitialized
[2]
BUG: KMSAN: kernel-infoleak in _copy_to_iter
raw_recvmsg
Uninit was stored to memory at:
ipmr_cache_report
ipmr_cache_unresolved
ipmr_get_route
Uninit was created at:
pskb_expand_head
skb_realloc_headroom
ipmr_get_route
Bytes 4-7 of 28 are uninitialized
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <netdev-bot+sashiko@kernel.org>
Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/0545f0c83f5ee2f6696210f87268e811ef655715.1792476357.git.zhilinz%40nebusec.ai
Assisted-by: LLM
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
net/ipv4/ipmr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index acacaae05cc4..eac23f251bfd 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2506,6 +2506,7 @@ int ipmr_get_route(struct net *net, struct sk_buff *skb,
skb_push(skb2, sizeof(struct iphdr));
skb_reset_network_header(skb2);
iph = ip_hdr(skb2);
+ memset(iph, 0, sizeof(*iph));
iph->ihl = sizeof(struct iphdr) >> 2;
iph->saddr = saddr;
iph->daddr = daddr;
--
2.56.0
next parent reply other threads:[~2026-10-25 7:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261025071729.34967-1-idosch@nvidia.com>
2026-10-25 7:17 ` Ido Schimmel [this message]
2026-10-25 10:50 ` [PATCH net 1/2] ipmr: fully initialize the synthetic IP header in ipmr_get_route() Eric Dumazet
2026-10-25 7:17 ` [PATCH net 2/2] ipmr, ip6mr: validate packets injected into the register vif on xmit Ido Schimmel
2026-10-25 10:52 ` Eric Dumazet
2026-10-26 23:39 ` Jakub Kicinski
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=20261025071729.34967-2-idosch@nvidia.com \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/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