Article View: linux.kernel.netdev
Article #16955Re: [PATCH net v2 2/2] mptcp: avoid wrapping blackhole timeout
From: netdev-bot+sashiko
Date: Mon, 16 Nov 2026 05:21
Date: Mon, 16 Nov 2026 05:21
124 lines
12851 bytes
12851 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message body refers to earlier revisions of this
patch: "In the v1 arithmetic-only test, the unpatched kernel retried…
- [Low] mptcp_active_should_disable() (net/mptcp/ctrl.c:514-515) now
silently clamps the disable interval to MAX_JIFFY_OFFSET.
--
mptcp: avoid wrapping blackhole timeout
This commit computes the active-disable interval in
mptcp_active_should_disable() in u64, so multiplier * blackhole_timeout *
HZ no longer wraps in 32-bit arithmetic. The result is capped at
MAX_JIFFY_OFFSET before it is added to active_disable_stamp.
> This issue was found using a static analysis tool. A loopback reproducer
> induced 12 MPTCP blackholes and waited 1.2 seconds before opening another
> connection. In the v1 arithmetic-only test, the unpatched kernel retried
> MP_CAPABLE, while the fixed kernel used TCP fallback directly. The
> reproducer required neither kernel modifications nor fault injection.
[ ... ]
> On the v2 kernel, the loopback blackhole reproducer completed all 12
> clients and the probe used TCP fallback directly instead of retrying
> MP_CAPABLE.
[Severity: Low]
This isn't a bug, but the changelog refers to earlier revisions of the
patch ("In the v1 arithmetic-only test" and "On the v2 kernel"). After the
patch is merged, v1 and v2 mean nothing in git log. This is also tagged
for stable, so backporters will read it without the mailing list thread.
Could the reproducer results be described once, against the final code,
with the per-version history moved below the --- line?
The numbers themselves check out. 64 * 6912213 * 1000 = 442,381,632,000,
which is 512 mod 2^32. With 12 blackholes the multiplier is
1 << min(11, 6) = 64, and a 1.2 second wait is longer than 512 jiffies at
HZ=1000.
> diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
> index 63c5747f0f63c..0b10e94e7f43c 100644
> --- a/net/mptcp/ctrl.c
> +++ b/net/mptcp/ctrl.c
[ ... ]
> @@ -501,12 +502,17 @@ bool mptcp_active_should_disable(struct sock *ssk)
> /* Paired with smp_mb__before_atomic() in mptcp_active_disable() */
> smp_rmb();
>
> - /* Limit timeout to max: 2^6 * initial timeout */
> + /* Limit the backoff multiplier to 64. */
> multiplier = 1 << min(disable_times - 1, 6);
> + delay = (u64)multiplier * blackhole_timeout * HZ;
>
> - /* Paired with the WRITE_ONCE() in mptcp_active_disable(). */
> + /*
> + * Cap the delay for safe jiffies comparisons on 32-bit systems.
> + * The timestamp read is paired with WRITE_ONCE() in
> + * mptcp_active_disable().
> + */
> timeout = READ_ONCE(pernet->active_disable_stamp) +
> - multiplier * blackhole_timeout * HZ;
> + min(delay, MAX_JIFFY_OFFSET);
[Severity: Low]
On 32-bit kernels MAX_JIFFY_OFFSET is ((LONG_MAX >> 1) - 1), which is
0x3ffffffe jiffies, or about 12.4 days at HZ=1000. Does this clamp
silently shorten blackhole_timeout values that the sysctl still accepts?
The sysctl entry only sets a lower bound:
net/mptcp/ctrl.c:mptcp_sysctl_table[] {
...
{
.procname = "blackhole_timeout",
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_blackhole_detect_timeout,
.extra1 = SYSCTL_ZERO,
},
...
}
So values up to INT_MAX are accepted. Anything above about 1,073,741
seconds is cut short even on the first blackhole (multiplier 1). Smaller
values stop doubling before they reach the 64x factor.
time_before() handles deltas up to LONG_MAX, so the cap is half of what
the comparison can take. The old code compared intervals between 2^30 and
2^31-1 jiffies correctly, and those are now shortened.
For example, take HZ=1000, blackhole_timeout = 2000000 and a first
blackhole. The old code disabled active MPTCP for 2e9 jiffies (about 23
days). The new code disables it for 1,073,741,822 jiffies (about 12.4
days).
The commit message says:
Preserve the existing sysctl input range and backoff
for representable intervals.
But this interval is representable and still gets shortened.
Documentation/networking/mptcp-sysctl.rst, and the zh_CN translation,
still describe blackhole_timeout as an initial period that will "grow
exponentially", with no upper bound mentioned.
Should the clamp be documented, or should the sysctl get an upper bound
that matches it?
64-bit kernels are not affected, because MAX_JIFFY_OFFSET there is far
above 64 * INT_MAX * HZ.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794672619.git.x-professor%40outlook.com
Technical Details
Message-ID:
<179480650425.3133.15313880518132043396@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364067-linux-kernel-netdev=dewy.ruReferences:
<070c69fa36f83fe47a5eb6d1434f543dabe930e7.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-364067-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 2/2] mptcp: avoid wrapping blackhole timeout Date: Mon, 16 Nov 2026 05:21:44 +0000 Organization: Usenet Network Message-ID: <179480650425.3133.15313880518132043396@kernel.org> References: <070c69fa36f83fe47a5eb6d1434f543dabe930e7.1794672619.git.x-professor@outlook.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1986451"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:WZhxKmS81TasNddyYvmKNHQ2al4= sha256:pGm5smw+K1QEYydSSf+Zc+Wls7DFgaHXqMf6xxq4jt4= sha1:/sxbfYrf93JDWE5KP6z5KL279gw= sha256:klJUOhpsWuc+4ThtWSI4mb+vD8oV+mWbOyFvxRQzqVY= 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 940AB114B2C; Mon, 16 Nov 2026 08:22:10 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 T6-qy9QMxvLG; Mon, 16 Nov 2026 08:22:06 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364067-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 8D83B114B0B; Mon, 16 Nov 2026 08:21:58 +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 66B48315A0; Mon, 16 Nov 2026 05:21:49 +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=1794806507; b=0Fd1e/J7tHpvsx/hhniJPaiJti8m2Af9657GlcagVpL2Pv9bY/GHAikW3qRxAvviRack S71wLFeDrQ8xh9FUb3JS4CcKSKVo3p4OwnQCJthNCiVCyXxXUOtEtvFfq6N0J4IjiyA/+ 427LtmjH6dTcnDWvYBiifgKGw1Z33PHhVzhaQPEBvbCGeQ5w8ai1Xrlz8jJ88w0e9FgAB ymk5AI2L7BInNmG7MWJHP5Xq/QiSfxK/pPuJKMBtvo4aPU8cWoiKRkdjiiNy59C9MuO/5 AVi55OY2WpfXp+dReVXWTcJfGs4BVux77lDh5b6uvufatVYhw+L5YXr9T8KMH5eceZQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794806507; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=jEfV+JQF7FD38ojElSzO1mtu8Ghpnr4QfBw1VO2XPSQ=; b=R6wTwfrTKDjSiSqHAJBPyWqCKPSOCkEPBC6XnGl+zo9seTmvasGQ6NSJdEsGgFJZQHmg fFgqp86bvBrJ06vRIh0dE+0nTsenM1BMX53tKJOnsCGeHDHYOFs03RMl25remcF2rX5GI xZZMBQORMdPy44M9iksMFSC7wy8RvEB6gNTWtBUZNK699LI39DeLNCy00E4BigWeEBLdq S6b+slC45f2ph1Zc3w3fuH4Bk68iFuka9W9FzsXa5XqpOpXyelb3dGsrU/cqnCFHyU4DF /eRuGQpkR4XbUoMtIYTb4OMpWzucOqjs3xpoHT/xmXxGc4DJB1fDC6B7l88nkZPCSLQ== 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=M9xEqbK8; 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 4A728606A882; Mon, 16 Nov 2026 05:21:47 +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=M9xEqbK8 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=1794806506; b=q97fLDVIKyvcMofK44QSdjl8DibpsFSzj6fS2DXToX62GagCYqmwAjiB1A0FltaWcSpR Zas6kjP0+/UEYoJ+ptaxKQvpbhd0PLcy2LPfE8OJ6XiFwET3xftaPT1YZPa79vFIRHHp3 Mkr5awwml7OsWpaMeOaP4gdTlPxT/SZRj6l5Nm6RYbp+oGlIJatPGgy93dB3f9lzAsd8G gqPqz/H72io1YX73q+vAvidtqscmaSoCf71fp8DE+FJa3q/7Di/5UNOncfBKeIizngTZW gCbR5adAkX4yUjkSp9YTJRcv6XZcdbG7Yi9sYdtt3cV/TLXkqdbSIRzhSIWUiVcyf5A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794806506; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=jEfV+JQF7FD38ojElSzO1mtu8Ghpnr4QfBw1VO2XPSQ=; b=q2FSFaQcKAH7o/aGzNmQDG7Y9PrzUVqBseWKS7xhs+AgrHrNX9KgknePMQoRtObuZdRL DpiwxmxWQwnTZ7DB6bnP024oVMByWSrJWHvrwkpr7Z1Vu4OzlzuggUGvOWK5SHBnM1wik FBzGOipQ/1IAA2kc1qfkh8u5n0e3hFhqBADeFjGi0mJ+ts6swwdZeaRqCHM2ksIbyrDgc x7aFdkNiTSKOAPniKAg0o8Z5D0eWIMI8scSgn0EZ6Ly7+4udQcOcwjFUfY1fgnUcDAByT HEcFyyd5iNEqI7jiXHQdSNzs9kOC+25AzL5hGnFHQpA7ClfgWroD1R9vRFvaSM1Gbgg== 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=M9xEqbK8; 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 6A5A5606A334; Mon, 16 Nov 2026 05:21:46 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6C991F000C4; Mon, 16 Nov 2026 05:21:44 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794806506; bh=jEfV+JQF7FD38ojElSzO1mtu8Ghpnr4QfBw1VO2XPSQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=M9xEqbK8ku6TWTxTq5yvkeE98zgiMdOubhckbSmZq2fehatceTUvvOt6B/Xg+69Mq TtsweDShv4do/NIiGebsAFq4Gj+Fgd14ptYRa7T3a3nF8pQ/Ym5lR9apF4tMSFsDAX SttAb/pY9sDt06vkKNvxUlKJJHxwAApReIfRY3niXP58rZ4ZLCoNpAwR5fzHCtKS4v yHbVDJaQ65eOb9t9Qytur1d5G5fwN0JMZ+ziI55498x3vyY0wS6SdbPncYXzajmgkF TkE3heWXrvUJ8lmc4zQ8DgVRSwcMpYA0iFsCSTTDfYJpo/UACiYi4HF4SpXUTekeBN eDRGq+q1xgg6A== X-Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, linux-doc@vger.kernel.org, edumazet@kernel.org, ncardwell@google.com, gang.yan@linux.dev, kuniyu@google.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, matttbe@kernel.org, martineau@kernel.org, geliang@kernel.org, ycheng@google.com, weiwan@google.com, stable@vger.kernel.org, yangang@kylinos.cn X-In-Reply-To: <070c69fa36f83fe47a5eb6d1434f543dabe930e7.1794672619.git.x-professor@outlook.com> X-sashiko-severity: Low 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