* Re: [PATCH net] tcp: fix reordering addition overflow in MTU probing
2026-10-28 16:02 [PATCH net] tcp: fix reordering addition overflow in MTU probing Eric Dumazet
@ 2026-10-28 16:26 ` Neal Cardwell
2026-10-28 19:29 ` Kuniyuki Iwashima
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Neal Cardwell @ 2026-10-28 16:26 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Kuniyuki Iwashima,
Simon Horman, netdev, Kyle Zeng, stable, Wyatt Feng, Ren Wei
On Wed, Oct 28, 2026 at 12:02 PM Eric Dumazet <edumazet@kernel.org> wrote:
>
> From: Kyle Zeng <kylebot@openai.com>
>
> Commit efb8763d7bbb ("net: ipv4: bound TCP reordering sysctl writes and
> MTU probe sizes") widened size_needed and the MSS multiplication, but
> tp->reordering + 1 is still evaluated as u32. RTAX_REORDERING accepts
> an unrestricted u32, and tcp_init_metrics() can install U32_MAX.
>
> In that case the extra-data requirement becomes zero. A write queue
> with probe_size - 1 data bytes and a FIN satisfies the sequence-space
> check. The coalescing walk can pass the queue head to
> tcp_skb_can_collapse(), and tcp_clone_payload() can produce an skb
> whose advertised payload exceeds the data in its fragments. Local
> delivery followed by TCP_ZEROCOPY_RECEIVE can then walk beyond the
> fragment array. KASAN reports a slab-out-of-bounds read in
> can_map_frag().
>
> Cast reordering before incrementing it so the arithmetic handles the
> entire u32 metric range. For U32_MAX, the required size exceeds the
> 32-bit queue and window limits, so the existing checks skip the probe.
> The calculation is unchanged for all other reordering values.
>
> Fixes: efb8763d7bbb ("net: ipv4: bound TCP reordering sysctl writes and MTU probe sizes")
> Cc: stable@vger.kernel.org
> Cc: Wyatt Feng <bronzed_45_vested@icloud.com>
> Cc: Ren Wei <n05ec@lzu.edu.cn>
> Signed-off-by: Kyle Zeng <kylebot@openai.com>
> Signed-off-by: Eric Dumazet <edumazet@kernel.org>
> ---
> net/ipv4/tcp_output.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index c8865205cdc8bacea4e37f67eb60730cb17294aa..39803b874c3373ca635454690a445ba072c05a62 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -2720,7 +2720,7 @@ static int tcp_mtu_probe(struct sock *sk)
> mss_now = tcp_current_mss(sk);
> probe_size = tcp_mtu_to_mss(sk, (icsk->icsk_mtup.search_high +
> icsk->icsk_mtup.search_low) >> 1);
> - size_needed = probe_size + (tp->reordering + 1) * (u64)tp->mss_cache;
> + size_needed = probe_size + ((u64)tp->reordering + 1) * tp->mss_cache;
> interval = icsk->icsk_mtup.search_high - icsk->icsk_mtup.search_low;
> /* When misfortune happens, we are reprobing actively,
> * and then reprobe timer has expired. We stick with current
> --
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Thanks Kyle and Eric!
neal
ps: It also looks good to the frontier LLM I checked with.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net] tcp: fix reordering addition overflow in MTU probing
2026-10-28 16:02 [PATCH net] tcp: fix reordering addition overflow in MTU probing Eric Dumazet
2026-10-28 16:26 ` Neal Cardwell
@ 2026-10-28 19:29 ` Kuniyuki Iwashima
2026-10-29 6:52 ` Jiayuan Chen
2026-10-29 16:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2026-10-28 19:29 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Neal Cardwell,
Simon Horman, netdev, Kyle Zeng, stable, Wyatt Feng, Ren Wei
On Wed, 28 Oct 2026 17:02:26 +0100, Eric Dumazet wrote:
> From: Kyle Zeng <kylebot@openai.com>
>
> Commit efb8763d7bbb ("net: ipv4: bound TCP reordering sysctl writes and
> MTU probe sizes") widened size_needed and the MSS multiplication, but
> tp->reordering + 1 is still evaluated as u32. RTAX_REORDERING accepts
> an unrestricted u32, and tcp_init_metrics() can install U32_MAX.
>
> In that case the extra-data requirement becomes zero. A write queue
> with probe_size - 1 data bytes and a FIN satisfies the sequence-space
> check. The coalescing walk can pass the queue head to
> tcp_skb_can_collapse(), and tcp_clone_payload() can produce an skb
> whose advertised payload exceeds the data in its fragments. Local
> delivery followed by TCP_ZEROCOPY_RECEIVE can then walk beyond the
> fragment array. KASAN reports a slab-out-of-bounds read in
> can_map_frag().
>
> Cast reordering before incrementing it so the arithmetic handles the
> entire u32 metric range. For U32_MAX, the required size exceeds the
> 32-bit queue and window limits, so the existing checks skip the probe.
> The calculation is unchanged for all other reordering values.
>
> Fixes: efb8763d7bbb ("net: ipv4: bound TCP reordering sysctl writes and MTU probe sizes")
> Cc: stable@vger.kernel.org
> Cc: Wyatt Feng <bronzed_45_vested@icloud.com>
> Cc: Ren Wei <n05ec@lzu.edu.cn>
> Signed-off-by: Kyle Zeng <kylebot@openai.com>
> Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net] tcp: fix reordering addition overflow in MTU probing
2026-10-28 16:02 [PATCH net] tcp: fix reordering addition overflow in MTU probing Eric Dumazet
2026-10-28 16:26 ` Neal Cardwell
2026-10-28 19:29 ` Kuniyuki Iwashima
@ 2026-10-29 6:52 ` Jiayuan Chen
2026-10-29 16:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Jiayuan Chen @ 2026-10-29 6:52 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni,
Kuniyuki Iwashima, Neal Cardwell
Cc: Simon Horman, netdev, Kyle Zeng, stable, Wyatt Feng, Ren Wei
On 10/29/26 12:02 AM, Eric Dumazet wrote:
> From: Kyle Zeng <kylebot@openai.com>
>
> Commit efb8763d7bbb ("net: ipv4: bound TCP reordering sysctl writes and
> MTU probe sizes") widened size_needed and the MSS multiplication, but
> tp->reordering + 1 is still evaluated as u32. RTAX_REORDERING accepts
> an unrestricted u32, and tcp_init_metrics() can install U32_MAX.
>
> In that case the extra-data requirement becomes zero. A write queue
> with probe_size - 1 data bytes and a FIN satisfies the sequence-space
> check. The coalescing walk can pass the queue head to
> tcp_skb_can_collapse(), and tcp_clone_payload() can produce an skb
> whose advertised payload exceeds the data in its fragments. Local
> delivery followed by TCP_ZEROCOPY_RECEIVE can then walk beyond the
> fragment array. KASAN reports a slab-out-of-bounds read in
> can_map_frag().
>
> Cast reordering before incrementing it so the arithmetic handles the
> entire u32 metric range. For U32_MAX, the required size exceeds the
> 32-bit queue and window limits, so the existing checks skip the probe.
> The calculation is unchanged for all other reordering values.
>
> Fixes: efb8763d7bbb ("net: ipv4: bound TCP reordering sysctl writes and MTU probe sizes")
> Cc: stable@vger.kernel.org
> Cc: Wyatt Feng <bronzed_45_vested@icloud.com>
> Cc: Ren Wei <n05ec@lzu.edu.cn>
> Signed-off-by: Kyle Zeng <kylebot@openai.com>
> Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net] tcp: fix reordering addition overflow in MTU probing
2026-10-28 16:02 [PATCH net] tcp: fix reordering addition overflow in MTU probing Eric Dumazet
` (2 preceding siblings ...)
2026-10-29 6:52 ` Jiayuan Chen
@ 2026-10-29 16:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-10-29 16:20 UTC (permalink / raw)
To: Eric Dumazet
Cc: davem, kuba, pabeni, kuniyu, ncardwell, horms, netdev, kylebot,
stable, bronzed_45_vested, n05ec
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 28 Oct 2026 17:02:26 +0100 you wrote:
> From: Kyle Zeng <kylebot@openai.com>
>
> Commit efb8763d7bbb ("net: ipv4: bound TCP reordering sysctl writes and
> MTU probe sizes") widened size_needed and the MSS multiplication, but
> tp->reordering + 1 is still evaluated as u32. RTAX_REORDERING accepts
> an unrestricted u32, and tcp_init_metrics() can install U32_MAX.
>
> [...]
Here is the summary with links:
- [net] tcp: fix reordering addition overflow in MTU probing
https://git.kernel.org/netdev/net/c/c1df9c0c0536
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread