Skip to content

tcp/mptcp: prevent blackhole timeout arithmetic wraparound

Yingjie Wang linux-doc lkml mptcp netdev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 3 repliesIn review
  2. v33 patches 4 repliesSuperseded
  3. v22 patches 3 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches4 repliesSuperseded

Changes in v4 from the cover letter

- Drop the Fixes tags from both patches.
- Leave the existing comments unchanged, as requested by Matthieu.
- Combine the MPTCP arithmetic fix and input limit into one patch.
- Name the MPTCP limit one_day_secs, as in TCP.
- Drop Gang Yan's Reviewed-by from the combined MPTCP patch because the added input limit was outside the patch he reviewed. Keep Eric's Suggested-by for the MPTCP input limit.
- Add Kuniyuki's Suggested-by for requesting a limit on the TCP sysctl.
- Move the test notes out of the commit messages, as requested by Eric.
- Rebase on net-next eb6d6c80d354.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2tcp: avoid wrapping Fast Open blackhole timeoutDocumentation/networking/ip-sysctl.rst net/ipv4/sysctl_net_ipv4.c net/ipv4/tcp_fastopen.c+5 -10 replies
2/2mptcp: avoid wrapping blackhole timeoutDocumentation/networking/mptcp-sysctl.rst net/mptcp/ctrl.c+6 -10 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEric DumazetMatthieu Baerts (NGI0)
SeriesR-b R-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH net-next v4 0/2] tcp/mptcp: prevent blackhole timeout arithmetic wraparound

The TCP Fast Open and MPTCP blackhole timeout calculations can wrap in 32-bit unsigned arithmetic, even on 64-bit kernels. With HZ=1000 and a 64-fold backoff, 67109 seconds becomes 8.7 seconds instead of about 50 days.

Compute both delays in u64, cap them at MAX_JIFFY_OFFSET, and limit both initial timeout sysctls to one day. The new input limits reject values that were previously accepted, so this series remains for net-next and is not intended for stable.

Changes since v3:

- Drop the Fixes tags from both patches.
- Leave the existing comments unchanged, as requested by Matthieu.
- Combine the MPTCP arithmetic fix and input limit into one patch.
- Name the MPTCP limit one_day_secs, as in TCP.
- Drop Gang Yan's Reviewed-by from the combined MPTCP patch because the added input limit was outside the patch he reviewed. Keep Eric's Suggested-by for the MPTCP input limit.
- Add Kuniyuki's Suggested-by for requesting a limit on the TCP sysctl.
- Move the test notes out of the commit messages, as requested by Eric.
- Rebase on net-next eb6d6c80d354.

v3: https://lore.kernel.org/r/[email protected]
v2: https://lore.kernel.org/r/[email protected]
v1: https://lore.kernel.org/r/[email protected]

Testing on v4 and its unmodified base, x86-64, HZ=1000:

- Loopback reproducers induced 12 blackholes with a 67109 second timeout and opened another connection 10 seconds later. The base kernel retried active TFO and MP_CAPABLE; v4 kept both disabled. Both probes completed using TCP on v4.
- Both sysctls accepted 0, 1, 3600, 86399 and 86400, and rejected negative and above-limit values with EINVAL without changing the stored value. These checks passed in the initial and a new network namespace, with unchanged defaults and independent namespace values.
- The affected objects built at each commit on x86-64 and i386 with W=1 and KCFLAGS=-Werror.

The 32-bit cap was checked by compilation and arithmetic, not at runtime. The TCP and MPTCP selftests were not run locally.

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

 Documentation/networking/ip-sysctl.rst    | 1 +
 Documentation/networking/mptcp-sysctl.rst | 1 +
 net/ipv4/sysctl_net_ipv4.c                | 1 +
 net/ipv4/tcp_fastopen.c                   | 4 +++-
 net/mptcp/ctrl.c                          | 6 +++++-
 5 files changed, 11 insertions(+), 2 deletions(-)

base-commit: eb6d6c80d35449c27471b1874f13066c09a8964d

Signature · 1 line
2.43.0