mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yingjie Wang <x-professor@outlook.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "mptcp@lists.linux.dev" <mptcp@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"edumazet@kernel.org" <edumazet@kernel.org>,
	"ncardwell@google.com" <ncardwell@google.com>,
	"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>
Subject: [PATCH net 0/2] tcp/mptcp: prevent blackhole timeout arithmetic wraparound
Date: Tue, 10 Nov 2026 15:47:56 +0000	[thread overview]
Message-ID: <cover.1794325665.git.x-professor@outlook.com> (raw)

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 442381632000 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. A loopback reproducer
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.

The base and fixed kernels used the same x86-64 HZ=1000 configuration.
The changed objects also build cleanly with W=1 under i386 defconfig,
with MPTCP, IPv6, and sysctl enabled. The i386 objects have no undefined
64-bit multiplication or division helper.

The current objects have identical disassembly and relocations to the
min_t() version on both architectures; the x86-64 objects also match
those from the runtime-tested kernel.

The runtime configuration had KASAN and UBSAN disabled. No BUG, WARNING,
or Oops diagnostic appeared. TCP and MPTCP selftests were not run.

The patches are independent and have separate Fixes tags.

Yingjie Wang (2):
  tcp: avoid wrapping Fast Open blackhole timeout
  mptcp: avoid wrapping blackhole timeout

 net/ipv4/tcp_fastopen.c | 4 +++-
 net/mptcp/ctrl.c        | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)


base-commit: 30c71476d842b094651bd7712f6c8ee8716147d0
-- 
2.43.0


             reply	other threads:[~2026-11-10 15:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 15:47 Yingjie Wang [this message]
2026-11-10 15:47 ` [PATCH net 1/2] tcp: avoid wrapping Fast Open blackhole timeout Yingjie Wang
2026-11-10 15:48 ` [PATCH net 2/2] mptcp: avoid wrapping " Yingjie Wang

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=cover.1794325665.git.x-professor@outlook.com \
    --to=x-professor@outlook.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=geliang@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=weiwan@google.com \
    --cc=ycheng@google.com \
    /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

all inboxes | Powered by JetHome®