Article View: linux.kernel.netdev
Article #7333Re: [PATCH net 1/2] tcp: fix shift-out-of-bounds in SYN-ACK retransmit timers
From: netdev-bot+sashiko
Date: Mon, 26 Oct 2026 06:50
Date: Mon, 26 Oct 2026 06:50
94 lines
11659 bytes
11659 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The commit message gets the TCP_DEFER_ACCEPT path wrong and
does not mention a user-visible change.
--
tcp: fix shift-out-of-bounds in SYN-ACK retransmit timers
The patch caps the shift amount in the request_sock SYN-ACK timeout helper
at 30. It also limits max_retries / max_syn_ack_retries to 127, the width
of the num_timeout field, and sends the TFO SYN-ACK timer through the same
bounded helper. A further hunk lowers the TCP_DEFER_ACCEPT conversion cap
in secs_to_retrans() from 255 to 127.
[ ... ]
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 99d7237a623d8..a309fd45ad425 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -358,7 +358,7 @@ static u8 secs_to_retrans(int seconds, int timeout, int rto_max)
> int period = timeout;
>
> res = 1;
> - while (seconds > period && res < 255) {
> + while (seconds > period && res < MAX_TCP_SYNACK_RETRIES) {
[Severity: Medium]
This hunk lowers the TCP_DEFER_ACCEPT cap from 255 to 127. It seems to be
the actual fix for the defer-accept trigger, but none of the three bullets
in the commit message describe it. Could the change list mention it?
The commit message also says:
TCP_DEFER_ACCEPT can derive a comparable count. Both feed the
max_retries / max_syn_ack_retries that decide how long a request_sock
keeps retransmitting SYN-ACKs.
Is that accurate? do_tcp_setsockopt() stores the converted value in
icsk_accept_queue.rskq_defer_accept, and syn_ack_recalc() checks it as a
separate condition:
net/ipv4/inet_connection_sock.c:syn_ack_recalc() {
...
*expire = req->num_timeout >= max_syn_ack_retries &&
(!inet_rsk(req)->acked || req->num_timeout >= rskq_defer_accept);
...
}
tcp_check_req() also compares req->num_timeout against rskq_defer_accept
directly. The value never passes through max_retries or
max_syn_ack_retries, so the new min_t() clamps in reqsk_timer_handler() and
tcp_fastopen_synack_timer() don't apply to it.
Before this patch, take rskq_defer_accept above 127 and a peer that sends a
bare ACK (acked=1) but no data. The 7-bit num_timeout can never reach
rskq_defer_accept, so expire stays false. reqsk_timer_handler() then keeps
re-arming through tcp_reqsk_timeout(), and the shift goes out of bounds once
num_timeout reaches 64.
That path only needs setsockopt(TCP_DEFER_ACCEPT) on the caller's own
listener, with the default tcp_synack_retries=5. The commit message gives
the trigger only as "Set tcp_synack_retries high enough", which needs root.
Would it help stable backporters to say that this is reachable without
privileges?
There is also a user-visible change here. setsockopt(TCP_DEFER_ACCEPT) now
stores at most 127 retransmits, and larger requested values are truncated
without notice. As a result, the largest value getsockopt(TCP_DEFER_ACCEPT)
can return drops from retrans_to_secs(255, 1, 120) = 29887 seconds to
retrans_to_secs(127, 1, 120) = 14527 seconds.
The ip-sysctl.rst update only covers tcp_synack_retries. Should the commit
message or the documentation mention the new TCP_DEFER_ACCEPT limit?
> res++;
> timeout <<= 1;
> if (timeout > rto_max)
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261023064915.401112-1-jiayuan.chen%40linux.dev
Technical Details
Message-ID:
<179299742989.3134.10967114195935725081@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351703-linux-kernel-netdev=dewy.ruReferences:
<20261023064915.401112-1-jiayuan.chen@linux.dev>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351703-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 1/2] tcp: fix shift-out-of-bounds in SYN-ACK retransmit timers Date: Mon, 26 Oct 2026 06:50:29 +0000 Organization: Usenet Network Message-ID: <179299742989.3134.10967114195935725081@kernel.org> References: <20261023064915.401112-1-jiayuan.chen@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1243512"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:XWSe40GFJP6ppJVaibMuW8hsydM= sha256:hXqMAiIWaPTpY8USiwNSwMYYtK8JDFAJv3UOTlBwAfM= sha1:ZNpovaTKZYY1HoI///zqQgLoPNw= sha256:omI/BVOPiijyVu7EHgb1xF1A2ADafAMHA3r0tkKnqxE= 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 66E0F125B8A; Mon, 26 Oct 2026 09:51:23 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.738 X-Spam-Status: No, score=-3.738 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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 6o-2pOonGCTw; Mon, 26 Oct 2026 09:51:19 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-351703-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id E8528125B7B; Mon, 26 Oct 2026 09:51:10 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id B89D821F05; Mon, 26 Oct 2026 06:51:04 +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=1792997464; b=dbO2MthzKsNDV1aCAURCD7lJq38lOUjTAFgHZChcIKt+Zk2ym8Uvd2cZzT8kwMSZ1/fC UG+XRtepO4hEj1TKNLUPCcZbNKFm7j4JDhXUBlOlg9pewCjKzjOJmBwh41cjKR7GB5KJb s+QmBHvPUgzHB/Q2LQC0Hm/ME6Mqw9gFCp9eVIkH1hiYzH+slaQw6sF6sPnl0zsoBX7hn 29sRxBhe+HIATLuf6fSGUzHYH04/MQ2LDfTQhiffMkXavTS5NGa5VL/POgUN45fEbbi2l uiKphT6+ZhS3UIeAVM2L9XH+yNeVKQ+OKrV34hlfHK+Cs7lpMAihrPzYj2dMPbl/foA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792997464; 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=WdCYRudtEDYPOH46p/Wih0pwrS9+80f8dSGtERPW1PE=; b=Y2tSFIM3kFKKlH0s4/MZA81jrLcRAUFNvSiJHr/8uyRdL06YlMXDOyzHG4C4mPo9XMKN ZrFXDYDnwFTDSRfCc0NZaLgkktkhB/sm9O8aoEdmThqgkrMUD5QglQ8dy6KOXgiokCf8F PNuLVJmKV6ZRV1chMtBEGlB/UOfg9cEn/3oHIkAXeHUpci5z1dCiqUv+OSEO6EuHy+cmA kMoL1E3FYdsy+b1EgPYpRlE/onlo0r9kanxwP7SWIetL6G/gGE0KsD/6AnkiJ+p77ONHI M+5+zha7Kdl89z86m5A7BSSTam2fHzaN6sflXAo2qcm50+QXSsVuMYJ4XHFRu32cDxA== 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=eTOXNwUp; 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 E598E606A31F; Mon, 26 Oct 2026 06:51:03 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eTOXNwUp 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=1792997432; b=IGEqzqGLCnw+AoO2JkIKLraDpTJyodBAyg0qDFAKGfojZTw9mHLjhilwziXH4aa75TeU 8UhtezIeMPtGYstPrjwxB4VPi1/vxFIlrwcPRvkmDrI16my6/0bamnqHb9v4jTH0lkayu niIdTsszD5UnfSv0re4M+ZXcE8yFzlqO93qukUk4gpHRhS5JQxX42LTHzpsJxPhOPswvb ANG0iRyQXwDoCMO0OYElch+GTh/Z+RYMRZ32LlLpyD26iyxlNABjg3rqblTzjrCM2Fcuj Pz2WjifhurZA/VuIILevCc0HLhYYXJ2U9mUCITle5A52TyzCVxYLDdFOPNbECWmTv0w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792997432; 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=WdCYRudtEDYPOH46p/Wih0pwrS9+80f8dSGtERPW1PE=; b=SY26ss1ILXB35XhWksCaXmpqHwMSOx15Aliwb0mcAahLzkPmkIx2wdGH7DiCxU3gW2Jw jY/WDIpPMtMy3M5wKI8rWSf77oV8UQhrxVoeqnRM01T0UCZcbvV9u0lDShspgeA0hrwE+ 95ZWhk9pGznehuCzksA2JMq2zDs3aWc+M1WRWKbE1UH6xq6bLALnoNqDOF/AFNhLdRVBd h6h2r50I1NvgjtDpwF3Ke5KlEAZEaNMy4kfvkg9WXV9bQnLQUhTl2dNqz1CtKqwnGpocQ j7WHTUinrNTsUjz2ii3PiVppMDTvl5y69Dp0FzH0l5Kt2tV/k6vCW3EXFCD3ThbTMRg== 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=eTOXNwUp; 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 ADC58606A31A; Mon, 26 Oct 2026 06:50:31 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C1C41F01825; Mon, 26 Oct 2026 06:50:30 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1792997431; bh=WdCYRudtEDYPOH46p/Wih0pwrS9+80f8dSGtERPW1PE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=eTOXNwUpY83L2zD0pNiRjvoA5e60H1H1rDNgnjv1s5ZGJqirSnmQu71gaK+qeoq1n 0X4tO2I2zAY780okWtzNuQgt5RfDpHrsV1ZmC62ZdV7UKfWl6lxFHr3om6tJgfbeQV 4FgXOEPRQv/ocMcsbPA62msjA/sfaflrvI2SxzyH50NwyrGYQC9lRnNzpmfvcDFof1 FX9L7ZZ8BunXl3WxVwdRSc9l5xLaKXscQGVaVCjJrKmHf4WSEftCgDmV5g/pDJmXjr jt0XAegyagAZKAaIJRHOMCHHFBwi0PQWNKrR1wfU6+DVB8tFYB5ShoC8vKwq+dFvX+ FADFmclygMf1Q== X-Cc: netdev@vger.kernel.org, stable@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, ncardwell@google.com, kuniyu@google.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261023064915.401112-1-jiayuan.chen@linux.dev> X-sashiko-severity: Medium 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