Netdev List
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Jun Yang <juny24602@gmail.com>
Cc: dhowells@redhat.com, marc.dionne@auristor.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org,
	linux-afs@lists.infradead.org, netdev@vger.kernel.org,
	junvyyang@tencent.com, corvus@tencent.com, stable@kernel.org
Subject: Re: [PATCH net] rxrpc: Fix kvec overflow when padding a path-MTU probe ACK
Date: Thu, 03 Dec 2026 12:17:51 +0000	[thread overview]
Message-ID: <1157002.1796300271@dhowells-thinkpadp1gen8.rmtgb.csb> (raw)
In-Reply-To: <20261125071652.56790-1-juny24602@gmail.com>

Jun Yang <juny24602@gmail.com> wrote:

> 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>

Acked-by: David Howells <dhowells@redhat.com>


      reply	other threads:[~2026-12-03 12:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  7:16 [PATCH net] rxrpc: Fix kvec overflow when padding a path-MTU probe ACK Jun Yang
2026-12-03 12:17 ` David Howells [this message]

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=1157002.1796300271@dhowells-thinkpadp1gen8.rmtgb.csb \
    --to=dhowells@redhat.com \
    --cc=corvus@tencent.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=junvyyang@tencent.com \
    --cc=juny24602@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=marc.dionne@auristor.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@kernel.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