* [PATCH net] rxrpc: Fix kvec overflow when padding a path-MTU probe ACK
@ 2026-11-25 7:16 Jun Yang
0 siblings, 0 replies; only message in thread
From: Jun Yang @ 2026-11-25 7:16 UTC (permalink / raw)
To: dhowells, marc.dionne
Cc: davem, edumazet, kuba, pabeni, horms, linux-afs, netdev,
junvyyang, corvus, stable
From: Jun Yang <junvyyang@tencent.com>
rxrpc_send_ACK() pads a PMTUD PING ACK out to call->peer->pmtud_trial +
sizeof(struct rxrpc_wire_header) by appending one PAGE_SIZE zeropage kvec
per page. The table it fills is call->local->kvec[], sized
1 + RXRPC_MAX_NR_JUMBO == 47 entries so that it can also hold a
maximum-size jumbo DATA packet. rxrpc_alloc_ack() has already used three
entries, so only 44 zeropage entries fit, and the loop has no upper
bound: a probe larger than 44 * PAGE_SIZE writes past the end of the
rxrpc_local allocation.
pmtud_trial can be driven that large because rxrpc_assess_MTU_size()
takes the peer MTU straight from dst_mtu(). An IPv4 output XFRM policy
with an unresolvable ESP template makes xfrm_lookup_route() return a
blackhole dst; ipv4_blackhole_route() points it at the loopback device
and dst_blackhole_mtu() returns dst_dev(dst)->mtu without the
IP_MAX_MTU clamp that ip_dst_mtu_maybe_forward() applies to ordinary
IPv4 dsts. With loopback's MTU raised inside a netns,
peer->pmtud_bad = if_mtu - hdrsize + 1 becomes huge and the probe search
in rxrpc_input_probe_for_pmtud() moves pmtud_trial far beyond 64K.
The XFRM policy only has to match the sport 7001 / dport 7000 that
rxrpc_assess_MTU_size() hardcodes, so it blackholes the route assessment
without affecting the call's own packets. CAP_NET_ADMIN in a new netns
is enough, which an unprivileged user obtains with
unshare(CLONE_NEWUSER|CLONE_NEWNET).
Clamp the route MTU to the maximum size of an IP datagram in
rxrpc_assess_MTU_size(), which keeps pmtud_bad bounded, and skip the
probe altogether in rxrpc_send_ACK() if its padding would not fit the
kvec table.
BUG: KASAN: slab-out-of-bounds in rxrpc_send_ACK (net/rxrpc/output.c:333)
Write of size 8 at addr ffff8880312f3630 by task krxrpcio/0/10441
Call Trace:
rxrpc_send_ACK (net/rxrpc/output.c:333)
rxrpc_input_call_event (net/rxrpc/call_event.c:484)
Fixes: eeaedc5449d9 ("rxrpc: Implement path-MTU probing using padded PING ACKs (RFC8899)")
Cc: stable@kernel.org
Reported-by: TencentOS Corvus AI <corvus@tencent.com>
Signed-off-by: Jun Yang <junvyyang@tencent.com>
---
A KASAN reproducer for this issue is available if requested.
net/rxrpc/output.c | 4 ++++
net/rxrpc/peer_object.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index 88cad087f13b..57fae49e9ce8 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -327,6 +327,10 @@ void rxrpc_send_ACK(struct rxrpc_call *call, u8 ack_reason,
if (len > probe_mtu)
goto skip;
+ /* The zeropage padding must fit in the kvec table. */
+ if (probe_mtu - len >
+ (ARRAY_SIZE(call->local->kvec) - nr_kv) * PAGE_SIZE)
+ goto skip;
while (len < probe_mtu) {
size_t part = umin(probe_mtu - len, PAGE_SIZE);
diff --git a/net/rxrpc/peer_object.c b/net/rxrpc/peer_object.c
index fa9a406e1168..310fe94d9f6c 100644
--- a/net/rxrpc/peer_object.c
+++ b/net/rxrpc/peer_object.c
@@ -156,6 +156,7 @@ void rxrpc_assess_MTU_size(struct rxrpc_local *local, struct rxrpc_peer *peer)
struct rtable *rt;
struct flowi fl;
struct flowi4 *fl4 = &fl.u.ip4;
+ unsigned int max_mtu;
#ifdef CONFIG_AF_RXRPC_IPV6
struct flowi6 *fl6 = &fl.u.ip6;
#endif
@@ -179,6 +180,7 @@ void rxrpc_assess_MTU_size(struct rxrpc_local *local, struct rxrpc_peer *peer)
return;
}
dst = &rt->dst;
+ max_mtu = IP_MAX_MTU;
break;
#ifdef CONFIG_AF_RXRPC_IPV6
@@ -195,6 +197,7 @@ void rxrpc_assess_MTU_size(struct rxrpc_local *local, struct rxrpc_peer *peer)
_leave(" [route err %d]", dst->error);
return;
}
+ max_mtu = IP6_MAX_MTU;
break;
#endif
@@ -202,7 +205,8 @@ void rxrpc_assess_MTU_size(struct rxrpc_local *local, struct rxrpc_peer *peer)
BUG();
}
- peer->if_mtu = dst_mtu(dst);
+ /* A blackhole dst reports the device MTU with no IP_MAX_MTU clamp. */
+ peer->if_mtu = umin(dst_mtu(dst), max_mtu);
peer->hdrsize += dst->header_len + dst->trailer_len;
peer->tx_seg_max = dst->dev->gso_max_segs;
dst_release(dst);
base-commit: c5de2ce2fccdb7d3b48946179634eaa3d7ce2e7e
prerequisite-patch-id: 73dc5424c05c31bf826b8438dff12ad2acee90e4
--
2.56.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-25 7:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 7:16 [PATCH net] rxrpc: Fix kvec overflow when padding a path-MTU probe ACK Jun Yang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.