๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16577

Re: [PATCH net v2 0/2] tcp/mptcp: prevent blackhole timeout arithmetic wraparound

#16577
From: Eric Dumazet
Date: Sun, 15 Nov 2026 08:24
112 lines
13973 bytes
Le sam. 14 nov. 2026 ร  17:12, Yingjie Wang <x-professor@outlook.com> a รฉcrit :
>
> The TCP Fast Open and MPTCP blackhole handlers multiply writable timeout
> sysctl values before adding the result to a jiffies timestamp. The
> multiplication is performed in 32-bit unsigned arithmetic, so a large
> value can wrap into a short delay even on a 64-bit kernel.
>
> With HZ=1000, a timeout of 6912213 seconds and the maximum multiplier of
> 64 should produce 442,381,632,000 jiffies, but the current calculations
> truncate the result to 512 jiffies. Both patches compute the delay in u64
> and cap it at MAX_JIFFY_OFFSET before adding it to the saved timestamp.
>
> The issues were found using a static analysis tool. In the v1 arithmetic
> A/B tests, loopback reproducers induced 12 blackholes, waited 1.2 seconds,
> and then made a new connection:
>
>   TFO:   base probe 1.026 s, TCPFastOpenActiveFail +1;
>          fixed probe 0.000 s, TCPFastOpenActiveFail +0.
>   MPTCP: base probe 3.087 s, MPCapableSYNTXDisabled +0;
>          fixed probe 0.000 s, MPCapableSYNTXDisabled +1.
>
> The TFO counter records another failed active Fast Open attempt. The
> MPTCP counter records a connection that skips MP_CAPABLE and falls back to
> TCP while active MPTCP is disabled.
>
> Changes since v1:
>
> - Add a reasonable upper bound for the TCP Fast Open sysctl, as requested
>   by Kuniyuki Iwashima. This version proposes one day (86400 seconds),
>   using the existing IPv4 one_day_secs bound, and documents that limit.
>   Keep the existing MPTCP sysctl input range.

The one day limit, the u64 computation and the clamp look fine to me
for the TCP side: with HZ=1000, 64 * 86400 * HZ still does not fit in
32 bits, and 32-bit kernels need the interval to stay below 2^31 jiffies
for time_before().

Why is MPTCP left alone? Kuniyuki's remark applies equally to
net.mptcp.blackhole_timeout: nobody needs a multi-day initial timeout
there either. I will let MPTCP maintainers decide, but having the two
sysctls behave differently looks odd.

> - Clarify that the multiplier is limited to 64 and the final delay is
>   separately capped for safe jiffies comparisons on 32-bit systems,
>   addressing Gang Yan's comment. Keep the READ_ONCE/WRITE_ONCE pairing
>   annotations next to the timestamp reads.
> - Identify the original runtime results as v1 evidence in both commits.

Please do not do that. The changelog of each patch should describe the
problem and the fix. Version history and test notes ("In the v1
arithmetic-only test...", "On the v2 kernel...") belong in the cover
letter or after the --- marker, not in the commit message.

> - Retain Gang Yan's Reviewed-by tag on the unchanged MPTCP arithmetic fix.
>
> v1: https://lore.kernel.org/r/cover.1794325665.git.x-professor@outlook.com
>
> On the final v2 x86-64 HZ=1000 kernel, TCP accepts 86400 and rejects 86401;
> MPTCP still accepts 86401 and INT_MAX. Boundary tests also cover zero,
> negative and oversized values, failed-write preservation, defaults, and
> network namespace isolation. The large timeout used in the v1 TFO test
> is now rejected by the TCP sysctl limit.
>
> The MPTCP blackhole test was rerun on this v2 kernel: all 12 clients
> completed, and the probe used TCP fallback directly (0.000 s,
> MPCapableSYNTXDisabled +1). The full x86-64 kernel build and affected
> object builds on x86-64 and i386 passed. The upstream TCP and MPTCP
> selftest suites were not run. Full allyesconfig/allmodconfig W=1 builds
> stopped at warnings promoted to
> errors in unchanged lockdep, coda, and x86 callthunks code;
> the affected objects passed W=1 KCFLAGS=-Werror in both configurations.
>
> The patches are independent and have separate Fixes tags.

About the Fixes/stable tags:

This needs an admin to set a timeout nobody would use, and the only
consequence is that active TFO (or MPTCP) is retried sooner than
requested.

Also patch 1 now makes the TCP sysctl reject values that were accepted
before. I do not think we want that in stable trees.

Please drop the Cc: stable and target net-next.

Thanks.

>
> Yingjie Wang (2):
>   tcp: avoid wrapping Fast Open blackhole timeout
>   mptcp: avoid wrapping blackhole timeout
>
>  Documentation/networking/ip-sysctl.rst |  1 +
>  net/ipv4/sysctl_net_ipv4.c             |  1 +
>  net/ipv4/tcp_fastopen.c                | 12 +++++++++---
>  net/mptcp/ctrl.c                       | 12 +++++++++---
>  4 files changed, 20 insertions(+), 6 deletions(-)
>
>
> base-commit: 30c71476d842b094651bd7712f6c8ee8716147d0
> --
> 2.43.0
>
Technical Details
Message-ID: <CAL4WiirENP_SBccpu3qq51f6u4E7BwFoadEARZctwm0CGNCusg@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363610-linux-kernel-netdev=dewy.ru
References: <cover.1794672619.git.x-professor@outlook.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363610-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 0/2] tcp/mptcp: prevent blackhole timeout
 arithmetic wraparound
Date: Sun, 15 Nov 2026 09:24:04 +0100
Organization: Usenet Network
Message-ID: <CAL4WiirENP_SBccpu3qq51f6u4E7BwFoadEARZctwm0CGNCusg@mail.gmail.com>
References: <cover.1794672619.git.x-professor@outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1755076"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6Xv6XkmS3SSe6OgreZS6DJtIEUw= sha256:2iYsxsTOpHFXPrXBYgahJ6Ul86WzmQokzoqgHtRqokU=
	sha1:l707yQRfCUyvHIXCN7p1GLj0J9c= sha256:Fq5I76qphYysm3NeP3pNJAsfQcUBQnuV7KJizpYcUj8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id A2C7611496D; Sun, 15 Nov 2026 11:24:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id IYdU81Xngryy;
	Sun, 15 Nov 2026 11:24:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363610-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 2A89C114967; Sun, 15 Nov 2026 11:24:20 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 5EF6A2E2E6; Sun, 15 Nov 2026 08:24:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794731056;
	b=qWmWycd33hojsyCTakvCHhvT3F/YDkKxXIi+Y5f5a5Ulm6HfWTZPpw1OtCUuUC6ejCth
	 1TYSzgCrdySuOB66S4YXcm1tF2sHyaQzPoXg7dyvWZtx3ufSV/FcW38fFT6n08BZOedVz
	 7GKjw1vW34zotKwVvHnwWU9hMh1qv6JOX1hBSriGC+5iO2ENf4h41457NaeA/WypRNt31
	 IBUXMEUOHZtff31wEvtRt/06+9HpAOAaKFe+K75omAi+FrD2xgOCAq7G+2TQw2rJPkA6x
	 ClnNIXhpKyv0I7mdp9mKY0PsmkGfkdyubLfXQuZTbTZTzi81duH+e83sc0J1YNM3jOw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794731056;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Gm-Message-State:X-Received:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=Hq186HcHzYDaq7zOMRjbrOqIIwfSHvf8FBnXTnHKzXM=;
	b=QZa+ldASk0O93pxryNSQTOEftV0JBbDc7Ho8J9qDnbw+jFSaA/lUTscQxrCCnV+ixN+G
	 VWw/4OMJMZKBWU4Ol9xiBMEdxehTaOtEI1pSu0AWA6MRBeWZzylBwQprv4jb4b3Gq8B0Y
	 IGfUoNPQhVifwlmjqguv4Nz+qBUeP3eybdla7+cw5nmAcDfg/Co6OZQ2P3aMqGgHerdP7
	 ymHj8Gw3JeysgVWhEyBEs3YtNcS1erEYduOTFs7CvTsYjnsHVB7j8p/mKWL4bBBvGM8D3
	 YY8X597wk43Dl5m5Krcm3XZ425+4uejGM2LNAyMihXMLpMmLbD3Mh/lQ5ZjYvxniYsQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EQ8gElEn;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id CE0A4606A88B;
	Sun, 15 Nov 2026 08:24:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EQ8gElEn
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794731056;
	b=ntZvR6ro3oFythSlpGWx19mZlol+ho1AeCVEZ52PjB0U13MWraC86W8pWSu8tsfivs3F
	 3ZEl/XZF5mTpOJ/rYyvksAOJQKKv6iKDHt8Lm6C5zjS9WF6BjGcXzkgPvIeNZcXzU0oc5
	 KWNSoChbXMUPG/dgJBDZXRWIGiz7LBEkn+FxJo5Tck9/psaBvofhBm7QaFN5MEDZXwbmr
	 3Z1ZKhmZNSGBeN/TK4Bah+YP1G8o/MkMXiKBzXL9XsDNVuJCLvHykc3TOnDvp8P2uRl9g
	 UDNjadyNIOUguQMeivpiB/AsF9pdcNwx5HPiZC7rVv6Pti53fOdMTZCOW5rCzSx6azg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794731056;
	h=Received:DKIM-Signature:Received:X-Gm-Message-State:X-Received:
	 MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=Hq186HcHzYDaq7zOMRjbrOqIIwfSHvf8FBnXTnHKzXM=;
	b=rVp1EAyM4qCOY0833tRiiprIbs/7PYkOEIm4ooVk9Oj9+LC3ODhLxc21DhBwXbA7bMwx
	 d1naiBllS2b4whqt6Vrw6Sv3DD/Obvi21ItBER5zB5H/QwX14FY910kkJXNJd3DCyP26B
	 0Xp9DRa03V8d6v0f5wjj6X84LTAejbg9EghXgtwMY4gI+ZLJvEvIMarc/wJ4LmVsV+zPr
	 KES9/uIutfKIaZXjDuaV3I0jVNlPmMcf4b06VDNnasiagNG4jU7qCgvuqRL1amlPKESo5
	 wBlnidTZwOtZt3gn9L2PEiPWFHOXEC5yiPGXJ1ab1Va/pqbxnWXtK2KBET7NEykd5tg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=EQ8gElEn;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE8F6606A33B
	for <netdev@vger.kernel.org>; Sun, 15 Nov 2026 08:24:15 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8533F1F000C6
	for <netdev@vger.kernel.org>; Sun, 15 Nov 2026 08:24:15 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794731055;
	bh=Hq186HcHzYDaq7zOMRjbrOqIIwfSHvf8FBnXTnHKzXM=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=EQ8gElEn+s4NqzNS5KqWN3kSvI6ph+XLoMLW4SuYbcAC77irL5Rw71hMl13khtfUC
	 w/gIGMyyc+vrbb7oLdzYstdCjZfP9/gMb9wiiQKElbVXKIKfIVdst8L0/+kydgakjs
	 qXw08gATlgXosPffII6Y1uup1yPUH+oOmv6+5B414pvzBSbaY3KWV4vtkrtB48mABm
	 CwE2LQA/C5nsXoPliB+lWKfZsFLgBQop65lbqrGoj/L3yqoFkcilsUandcT3MTiLyg
	 iXLECPul4Vq06LWyyG3MokQoMrqwKQ1QuQpv3zWbTGjiOr0RgfupJLBjp2yFcHqPfX
	 E8T7MWklGOt1Q==
X-Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-71ad099391dso339080eaf.3
        for <netdev@vger.kernel.org>; Sun, 15 Nov 2026 00:24:15 -0800 (PST)
X-Gm-Message-State: APuU4Z/xJZXiZPr751JlU0Oe+UstPYiup486PhXOxclU+lkV9CdFrr7e
	Nqg6lZRFqip/Cn8Cz7aKUWIF9Z3s2oTMXieYsSifmEzkGUiMTRrA2nKMkFO9/bZOU8qdBYOEVXR
	NhaXLpKFizvAsD/N6gfDMIVjsdrFg8CU=
X-Received: by 2002:a05:6820:a70c:10b0:71a:eea9:8173 with SMTP id
 006d021491bc7-71aeea9868fmr74562eaf.85.1794731054847; Sun, 15 Nov 2026
 00:24:14 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <cover.1794672619.git.x-professor@outlook.com>
X-Gmail-Original-Message-ID: <CAL4WiirENP_SBccpu3qq51f6u4E7BwFoadEARZctwm0CGNCusg@mail.gmail.com>
X-Gm-Features: AclHuK-t99I7UXoH9TmlU6O0jB4ekfdvLqJegkYIbqioWircJJ73o_0Q7EGKhbQ
X-Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "mptcp@lists.linux.dev" <mptcp@lists.linux.dev>, 
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "corbet@lwn.net" <corbet@lwn.net>, 
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>, "rdunlap@infradead.org" <rdunlap@infradead.org>, 
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>, "ncardwell@google.com" <ncardwell@google.com>, 
	"gang.yan@linux.dev" <gang.yan@linux.dev>, "kuniyu@google.com" <kuniyu@google.com>, 
	"davem@davemloft.net" <davem@davemloft.net>, "kuba@kernel.org" <kuba@kernel.org>, 
	"pabeni@redhat.com" <pabeni@redhat.com>, "horms@kernel.org" <horms@kernel.org>, 
	"matttbe@kernel.org" <matttbe@kernel.org>, "martineau@kernel.org" <martineau@kernel.org>, 
	"geliang@kernel.org" <geliang@kernel.org>, "ycheng@google.com" <ycheng@google.com>, 
	"weiwan@google.com" <weiwan@google.com>