* [PATCH net 0/1] ipv6: fix MSG_SPLICE_PAGES with a dst trailer in __ip6_append_data()
@ 2026-11-22 10:24 Kyuwon Cho
2026-11-22 10:24 ` [PATCH net 1/1] " Kyuwon Cho
0 siblings, 1 reply; 2+ messages in thread
From: Kyuwon Cho @ 2026-11-22 10:24 UTC (permalink / raw)
To: David Ahern, Ido Schimmel
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Willem de Bruijn, Simon Horman, David Howells, netdev,
linux-kernel
sendfile() of a UDPv6 datagram that needs fragmentation over an xfrm
tunnel hits a WARN_ON_ONCE() in __ip6_append_data() and fails with EIO.
The patch removes the MSG_SPLICE_PAGES branch that causes it, as
proposed in the report; Ido asked for it to be sent as a patch.
Report: https://lore.kernel.org/netdev/179497871649.630760.14878797494884573363@gmail.com/
The issue was found by an LLM-guided test generator that we are
developing as a research prototype; the report has the reproducer. The
patch was written with LLM assistance; we reviewed and tested it. With
it, the reproducer runs clean and all its sendfile() calls succeed,
where they all fail with EIO before.
Kyuwon Cho (1):
ipv6: fix MSG_SPLICE_PAGES with a dst trailer in __ip6_append_data()
net/ipv6/ip6_output.c | 2 --
1 file changed, 2 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH net 1/1] ipv6: fix MSG_SPLICE_PAGES with a dst trailer in __ip6_append_data()
2026-11-22 10:24 [PATCH net 0/1] ipv6: fix MSG_SPLICE_PAGES with a dst trailer in __ip6_append_data() Kyuwon Cho
@ 2026-11-22 10:24 ` Kyuwon Cho
0 siblings, 0 replies; 2+ messages in thread
From: Kyuwon Cho @ 2026-11-22 10:24 UTC (permalink / raw)
To: David Ahern, Ido Schimmel
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Willem de Bruijn, Simon Horman, David Howells, netdev,
linux-kernel
When __ip6_append_data() starts a new skb for a fragment that is not
the last one, it adds the dst's trailer_len to datalen. On the paged
path pagedlen was computed before that, so with an xfrm dst
copy = datalen - transhdrlen - fraggap - pagedlen;
is trailer_len instead of 0. getfrag() copies those bytes from the
message iterator, but the MSG_SPLICE_PAGES branch right after it also
runs when getfrag() succeeds and resets copy to 0, so length is not
reduced by the bytes just copied. On the next pass the splice branch
finds copy larger than what is left in the iterator, warns and returns
-EIO, so sendfile() of a UDPv6 datagram that needs fragmentation over
an xfrm tunnel fails:
WARNING: net/ipv6/ip6_output.c:1796 at __ip6_append_data+0x17ed/0x4b70
RIP: 0010:__ip6_append_data (net/ipv6/ip6_output.c:1796)
Call Trace:
<TASK>
ip6_make_skb (net/ipv6/ip6_output.c:2097)
udpv6_sendmsg (net/ipv6/udp.c:1717)
sock_sendmsg (net/socket.c:841)
splice_to_socket (fs/splice.c:811)
direct_splice_actor (fs/splice.c:863 fs/splice.c:1114)
splice_direct_to_actor (fs/splice.c:1023)
do_splice_direct (fs/splice.c:1157 fs/splice.c:1183)
do_sendfile (fs/read_write.c:1351)
IPv4 is not affected: __ip_append_data() does not add trailer_len to
datalen.
The branch was added by commit ce650a166335 ("udp6: Fix
__ip6_append_data()'s handling of MSG_SPLICE_PAGES"), when copy could
be negative on this path. Since commit 736b380e28d0 ("ipv6: account for
fraggap on the paged allocation path") a negative copy returns -EINVAL
before this point, so remove the branch.
Fixes: ce650a166335 ("udp6: Fix __ip6_append_data()'s handling of MSG_SPLICE_PAGES")
Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
---
net/ipv6/ip6_output.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index cb648c839431..5887e537f662 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1742,8 +1742,6 @@ static int __ip6_append_data(struct sock *sk,
err = -EFAULT;
kfree_skb(skb);
goto error;
- } else if (flags & MSG_SPLICE_PAGES) {
- copy = 0;
}
offset += copy;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-22 10:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-22 10:24 [PATCH net 0/1] ipv6: fix MSG_SPLICE_PAGES with a dst trailer in __ip6_append_data() Kyuwon Cho
2026-11-22 10:24 ` [PATCH net 1/1] " Kyuwon Cho
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®