]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ipvs: clear IPv4 options after rebasing tunnel ICMP errors
authorKyle Zeng <kylebot@openai.com>
Tue, 4 Aug 2026 06:10:55 +0000 (06:10 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 10 Aug 2026 18:27:07 +0000 (20:27 +0200)
ip_vs_in_icmp() rebases an skb from the outer ICMP packet to the
quoted original request before passing it to icmp_send(). However,
IPCB(skb)->opt still describes the outer IPv4 header.

A timestamp option in the outer header can therefore leave an offset
that points into the quoted transport header after the rebase.
__ip_options_echo() treats a byte at that stale location as the option
length and copies it into the fixed-size option storage on the
__icmp_send() stack, causing a stack out-of-bounds write.

Clear the stale option metadata after resetting the network header.
Keep the remaining control block fields, including the ingress
interface used by the ICMP response path.

Fixes: f2edb9f7706d ("ipvs: implement passive PMTUD for IPIP packets")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.6-sol Codex:gpt-5.5-cyber
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Co-developed-by: David Lee <david.lee@trailofbits.com>
Signed-off-by: David Lee <david.lee@trailofbits.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/ipvs/ip_vs_core.c

index 95af77b68851afa1c2e6b45ddd697f1209255a98..a46e7acdd8e1254866316a4698acf4f8c7f6dfc4 100644 (file)
@@ -1950,6 +1950,7 @@ ip_vs_in_icmp(struct netns_ipvs *ipvs, struct sk_buff *skb, int *related,
                if (pskb_pull(skb, offset2) == NULL)
                        goto ignore_tunnel;
                skb_reset_network_header(skb);
+               memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
                /* Ensure the IP header is present in headroom */
                if (!pskb_may_pull(skb, hlen_orig))
                        goto ignore_tunnel;