Article View: linux.kernel.netdev
Article #14931Re: [PATCH net 2/2] mptcp: avoid wrapping blackhole timeout
From: gang.yan
Date: Thu, 12 Nov 2026 07:15
Date: Thu, 12 Nov 2026 07:15
89 lines
11307 bytes
11307 bytes
>
> mptcp_active_should_disable() calculates the active-disable interval as
> multiplier * blackhole_timeout * HZ. Since all operands are 32-bit, a
> large blackhole_timeout can wrap the delay even on 64-bit kernels and
> make active MPTCP available again while the blackhole is still present.
>
> For example, with HZ=1000, a timeout of 6912213 seconds and the maximum
> multiplier of 64 should produce 442381632000 jiffies, but the current
> calculation truncates it to 512 jiffies.
>
> 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. The unpatched kernel retried MP_CAPABLE, while the patched
> kernel kept MPTCP disabled and used TCP fallback directly. The reproducer
> required neither kernel modifications nor fault injection.
>
> Compute the interval in u64 and cap it at MAX_JIFFY_OFFSET before adding
> it to the saved timestamp. This preserves the existing exponential
> backoff for representable intervals and prevents large values from
> wrapping into short timeouts.
>
> Fixes: 27069e7cb3d1 ("mptcp: disable active MPTCP in case of blackhole")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yingjie Wang <x-professor@outlook.com>
> ---
> net/mptcp/ctrl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
> index 63c5747f0f63..5224cfb3ed1f 100644
> --- a/net/mptcp/ctrl.c
> +++ b/net/mptcp/ctrl.c
> @@ -487,6 +487,7 @@ bool mptcp_active_should_disable(struct sock *ssk)
> unsigned long timeout;
> int disable_times;
> int multiplier;
> + u64 delay;
>
> pernet = mptcp_get_pernet(net);
> blackhole_timeout = READ_ONCE(pernet->blackhole_timeout);
> @@ -503,10 +504,11 @@ bool mptcp_active_should_disable(struct sock *ssk)
>
> /* Limit timeout to max: 2^6 * initial timeout */
> multiplier = 1 << min(disable_times - 1, 6);
> + delay = (u64)multiplier * blackhole_timeout * HZ;
>
Hi Yingjie,
Thanks for the patch. Basically LGTM,
Just two small questions:
> /* Paired with the WRITE_ONCE() in mptcp_active_disable(). */
> timeout = READ_ONCE(pernet->active_disable_stamp) +
> - multiplier * blackhole_timeout * HZ;
> + min(delay, MAX_JIFFY_OFFSET);
1. AFAICS, on 64bit machine, the largest possible delay is 64 * INT_MAX * HZ, far
less than MAX_JIFFY_OFFSET ((LONG_MAX >> 1) - 1 = 2^62 - 2). So is the min() intended for the
32-bit machine?
2. If so, should the comment be updated? Because there is a second timeout on 32-bit machine.
Thanks
Gang
Reviewed-by: Gang Yan <yangang@kylinos.cn>
>
> return time_before(jiffies, timeout);
> }
> --
> 2.43.0
>
Technical Details
Message-ID:
<a5e30ae63ebb4a71327031211b50b33230e50004@linux.dev>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361560-linux-kernel-netdev=dewy.ruReferences:
<cover.1794325665.git.x-professor@outlook.com> <738e11db58137c0082b53fb1662ab0b70763f51a.1794325665.git.x-professor@outlook.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361560-linux-kernel-netdev=dewy.ru From: gang.yan@linux.dev Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/2] mptcp: avoid wrapping blackhole timeout Date: Thu, 12 Nov 2026 07:15:45 +0000 Organization: Usenet Network Message-ID: <a5e30ae63ebb4a71327031211b50b33230e50004@linux.dev> References: <cover.1794325665.git.x-professor@outlook.com> <738e11db58137c0082b53fb1662ab0b70763f51a.1794325665.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="1033019"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Bm7Uf0UVtIcwL82rfpJTm3RZhi0= sha256:TdN9j8Ys+OpLA2KTV8zuIuWYrH2J+ddDpb7gwaX5xcU= sha1:Mz8aiHZTXHERmGw7MKkIMRzt1Tk= sha256:s2+6enTM2g8D+VBHgM1Jf3wdmDNHqcxSe65ucgwb/1c= 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 EFD24114132; Thu, 12 Nov 2026 10:18:12 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.151 X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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 (1024-bit key) header.d=linux.dev 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 9NGkVUXed_hg; Thu, 12 Nov 2026 10:18:09 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-361560-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id A42BD114127; Thu, 12 Nov 2026 10:18:01 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 5C3B36264E9; Thu, 12 Nov 2026 07:16:12 +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=1794467750; b=vq+GCo4Lmg3PqELiVQ7G5Waz0YHe6ie3ui8HTFv6f0pHJZiT2Qo/5b2wwQKVYXeNCODY OBLzoi+tEXbTjvjJo4IHGT7UOpSoRJhHrR8SGR7PaBrV4PvCbjK2kmwpdw/AlgS5+PMSW oFG3ixMtqMa6Xa/1GhS73KJmkB1OPiyZindBvYvD7dFp5kiYbAwpsibvIbcasl9O9QLc3 T/HT6uHy7sBTFCJImDedIyl9jV55PTmqcM7ZpiIWO+eRAWW+KLHoaA1bbeYvoELeNw8PH VbJPTPsvyCnmWG5heGbk0HlEqTysjEqS4pixlxopdjxzPEFzbsz796E7x9wPxSHf8tw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794467750; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Date:Content-Type: Content-Transfer-Encoding:From:Message-ID:TLS-Required:Subject:To:Cc: In-Reply-To:References; bh=j3lkRXeTopN25W5T7TjypdJfZTaOamQhEp8M9vnpXqE=; b=L1xbzZzH1KhJ4PtMlXLxzsC+xAS+s6neY28b9VkFCi1FT/c5NjLo9bodFp2dm0rcroAl IlZHeuo2Y0/tENSTv3GpLztm7KXacElG04v5ksOUUjpJzWxX2ap1NXcVhqDXZjkQRoisl wwLbtZeVMDIXnZ6cUqbsC08XaedR50Kpwa2o0foUTWW+oufEnXy/nr1sSf+NrE4GWsJfW 3r++aTv9DR8ruqlSxBpbC+X4/8rqIN8d157y0YuxKO+ks9/WODfnX8yXFiieLNdXqnc5+ 1nbBFwR5d7a48Be/gWTSoJk5qBhd0lXYUpjfGeQ8wIj6VpvYrdEuJg0VSN0Ne0a5dgQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=DtggPLY4; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 9576D606A8B3; Thu, 12 Nov 2026 07:15:50 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=DtggPLY4 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.157 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794467749; b=HwPGJbSGwBzlOp/ZQKuPQRx0+FExerbOndVz4N9Aw8h/nUtIOQSOIfSAYRBv+XQITo7G H1nwZfTusF3iJdW/sXKTpJoDYvIALsjxo5vLh3MUNBokzeI8+hPXcxCZTY1BgcFz0+sJJ 46qfJ9QyZvgSLcXHT6hSpFU87db+GtJ0A+mr1teTqjYN3xNlnc1abj0E0943giMAvOj25 t2xGBwk0Zv4aCGc11GHGzsRz6esrW2ASZ9VlirBxA+1gmZ17Bi89Rw04qRIUbvFWjGduN n7AqZsoAx7ia+r3LaEuc9cHXDVEqv2zXwIotEWjtQT6gO2T85L3CKll/ep/LF1UsMgg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794467749; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:MIME-Version:Date:Content-Type: Content-Transfer-Encoding:From:Message-ID:TLS-Required:Subject:To:Cc: In-Reply-To:References; bh=j3lkRXeTopN25W5T7TjypdJfZTaOamQhEp8M9vnpXqE=; b=YlrMb7/4QYO5J7juOfZF4SHclpNnTTQbmddEnYKm6LktvejFDEWewO7IRGU8MzuDtrSq 4P37Od/U/9YiU4peWM/xh6EmT9dwz6NNhKyBS0eAnJ1LpYMWuGkWd1q670BI1N1Pq39++ kdHfLBAVOC6OV2AAuZXFrqKie4xCzAxLNnKkmWxieKLF3Pr7jLKxjBr9n72RZ7ApYJAMD 8Tf5DmcHhxWz5iUzNQRvZmr0VAOLTkJFJScxTXF4sSENtUlEmTH/JcQ5M/dsVLwLUTNGp wUvTdU3jtwU0L1E/tp2VNNGX+JecmAO7jKNS9z1cp+iwzPlRB6H5WBr4jxF/yuC2icg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=DtggPLY4; arc=none smtp.remote-ip=95.215.58.157 X-Received: from mta1.migadu.com (out-157.mta1.migadu.com [95.215.58.157]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6713E606A32D for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 07:15:48 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6713E606A32D X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=UjhC1xevWrnpU/YrXy5BOtjdU/07FY90HOuK9yvSgnA=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1794467746; v=1; x=1795072546; b=DtggPLY4VHJjO0fkxmWtJOs4h7z/RrjlF5ytAOqiGr+vNDZRQY9nKvxmNJyVIbbwFIIvCsjz +JN5EM/ORQr7SSROnrxC/q1R/UyKVuhkolAydxYrEiFHSIbviqk0NKVG19q6T8jXd55J5WDLvO2 hztg7NJgfyG3QKW9FbCDfSTQ= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id 218df4a0f1ad0689; Thu, 12 Nov 2026 07:15:46 +0000 X-Mizu-Trace-ID: 218df4a0f1ad0689 X-Migadu-Flow: FLOW_OUT 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-TLS-Required: No X-Cc: mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, edumazet@kernel.org, ncardwell@google.com, 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 X-In-Reply-To: <738e11db58137c0082b53fb1662ab0b70763f51a.1794325665.git.x-professor@outlook.com>