From: netdev-bot+sashiko@kernel.org
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg
Subject: Re: [PATCH net 01/15] ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
Date: Sat, 14 Nov 2026 02:15:39 +0000 [thread overview]
Message-ID: <179462253904.2199510.6723175642724870986@kernel.org> (raw)
In-Reply-To: <20261113011447.2357709-2-pablo@netfilter.org>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] Commit "ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6" has
only `Fixes: 63dca2c0b0e7`.
- [Low] The commit message says "This fix does not depend on patch 2".
--
ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6
This patch changes both ICMPv6 handlers in IPVS. When ipv6_find_hdr()
stops at a non-first fragment and leaves ciph.len == ciph.off, the
embedded IPv6 header is now added to ciph.len. The skb_ensure_writable()
range used by the NAT paths then covers the addresses that
ip_vs_nat_icmp_v6() rewrites.
> This fix does not depend on patch 2. Stable kernels without commit
> 342e24a339b9 ("ipvs: do not mangle ICMP replies for non-first fragments")
> also need that commit to handle incoming ICMPv6 errors quoting
> non-first ESP fragments.
>
> Fixes: 63dca2c0b0e7 ("ipvs: Fix faulty IPv6 extension header handling in IPVS")
[Severity: Low]
The incoming half of this bug only seems to have become reachable with
342e24a339b9. That path is
ip_vs_in_icmp_v6()->ip_vs_icmp_xmit_v6()->ip_vs_nat_icmp_v6().
Before that commit, ip_vs_in_icmp_v6() had:
if (ciph.fragoffs)
return NF_ACCEPT;
342e24a339b9 changed it to:
if (ciph.fragoffs && !pp->dont_defrag)
return NF_ACCEPT;
ESP sets .dont_defrag = 1 in ip_vs_proto_ah_esp.c, so non-first ESP
fragments now reach ip_vs_icmp_xmit_v6(). There, wlen = ciph->len sizes
skb_ensure_writable(), and without this fix ciph->len equals ciph->off.
ip_vs_nat_icmp_v6() then writes the embedded addresses past that range.
The paragraph above reads as if 342e24a339b9 is only a functional
prerequisite. Should it say that 342e24a339b9 exposed the incoming-path
write, and add a second Fixes: 342e24a339b9 tag? The existing
Fixes: 63dca2c0b0e7 tag plus Cc: stable already covers backports, so
this is mostly about traceability.
> diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
> index 8a3c880fdb266..76213159404f0 100644
> --- a/net/netfilter/ipvs/ip_vs_core.c
> +++ b/net/netfilter/ipvs/ip_vs_core.c
> @@ -1206,6 +1206,13 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb,
> true, &ciph))
> return NF_ACCEPT; /* The packet looks wrong, ignore */
>
> + /* ipv6_find_hdr() does not include the embedded header for
> + * non-first fragments, add it so that ESP can pass and the
> + * NAT writable checks cover the rewritten addresses
> + */
> + if (ciph.len == ciph.off)
> + ciph.len += sizeof(struct ipv6hdr);
[Severity: Low]
This isn't a bug, but is "so that ESP can pass" accurate for the IPv6
paths? A len vs off comparison only exists on the IPv4 side, for example
in ip_vs_nat_icmp():
if (cih->ihl * 4 != ciph->len - ciph->off)
return false;
None of these compare ciph.len with ciph.off:
- ip_vs_out_icmp_v6()
- ip_vs_in_icmp_v6()
- handle_response_icmp()
- ip_vs_icmp_xmit_v6()
- ip_vs_nat_icmp_v6()
- the AH/ESP conn_in_get/conn_out_get handlers
So the only effect seems to be the larger skb_ensure_writable() range.
Later in the series, "ipv6: update *offset for non-first fragments in
ipv6_find_hdr()" makes ipv6_find_hdr() do this for non-first fragments:
*offset = start + sizeof(struct frag_hdr);
After that change, the first clause of this comment is no longer true.
The ciph.len == ciph.off check also can't fire any more, here or in the
copy added to ip_vs_in_icmp_v6().
Separately, the commit message says "This fix does not depend on patch
2." Once merged, "patch 2" won't point to anything in git history. Could
it name "ipv6: update *offset for non-first fragments in ipv6_find_hdr()"
instead?
> +
> pp = ip_vs_proto_get(ciph.protocol);
> if (!pp)
> return NF_ACCEPT;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113011447.2357709-2-pablo%40netfilter.org
next prev parent reply other threads:[~2026-11-14 2:15 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 1:14 [PATCH net 00/15] IPVS fixes for net Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 01/15] ipvs: avoid out-of-bounds write in ip_vs_nat_icmp_v6 Pablo Neira Ayuso
2026-11-13 1:16 ` netdev-bot+sinfo
2026-11-13 3:17 ` Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko [this message]
2026-11-13 1:14 ` [PATCH net 02/15] ipv6: update *offset for non-first fragments in ipv6_find_hdr() Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 03/15] ipvs: fix problems during connection deletion Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 04/15] ipvs: avoid stack overflow from recursive connection expiration Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 05/15] ipvs: reject FTP control ports as data ports Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 06/15] ipvs: ftp: skip conntrack templates in ip_vs_ftp_out Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 07/15] ipvs: ftp: add seqadj extension before linking the expectation Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 08/15] ipvs: update flags and seqs in backup server under lock Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 09/15] ipvs: read flags and seqs in master atomically Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 10/15] ipvs: honor the overload state and do not enter it forever Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 11/15] ipvs: validate cport in received sync records Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 12/15] ipvs: skip cport 0 connections in ip_vs_conn_out_get() Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 13/15] ipvs: do not create conns from packets with port 0 Pablo Neira Ayuso
2026-11-13 1:14 ` [PATCH net 14/15] ipvs: wait grace period before reusing destinations Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 1:14 ` [PATCH net 15/15] ipvs: pass correct sk to update_pmtu and on tunneling Pablo Neira Ayuso
2026-11-14 2:15 ` netdev-bot+sashiko
2026-11-13 22:34 ` [PATCH net 00/15] IPVS fixes for net Pablo Neira Ayuso
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=179462253904.2199510.6723175642724870986@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=ja@ssi.bg \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.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