From nobody Mon Jan 15 08:18:21 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TD4ld5rQ0z56Jgt; Mon, 15 Jan 2024 08:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TD4ld2rvwz4l9B; Mon, 15 Jan 2024 08:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705306701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k5mSBFGctdA5OTGDY34YKe8Y0KKoVITT7cqF67eUdUM=; b=t5jo113+163m9i8DnjS8xiytXTd1QwTYLOUCsQEeGX1lGemGPqLexXIFbj84DzysnSwXEZ TTcDp4DsOnKgns0tO+W71uziOnUUR2on8iVZQ5bkRERBEZKc2BSFcX9xYUHzsUMvDY5nrX V5Mwi8wo3rEVHeP26e7dUApdcb18Vn9eoAS63ZJv6uSqa8uU+kzUa4NPKst5Xu4ddwDPmn 5gOFtqRxj3gsijAECXhGeAA4MbmA2i+tN5QKexNxVvZaLEWYmvTMhwutnHxT+zmXq6C6+u kRDscnSJxD5pqY+xBbDL3M3E7fhsrEt8zvFYFSv/mg8LE/Rcy8NFGL5DzBjWeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705306701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k5mSBFGctdA5OTGDY34YKe8Y0KKoVITT7cqF67eUdUM=; b=S96KwmDkTFCfUil34nN6N4i5QbAFZ/GjFMxw2coP+UlXylcPPiRl5ntNew9Bad4fqt2V6X 0KmsIzmOXqwW51ii3Ny8rqbZJsZppvJu5F0B31Iz2F9ZKKsFM2cQ4VkOwd11gJM5kzYFq5 aQ79CD2FKopp3O/p5pivx4Smx30ew7XbYoDuikZ98gj1aTYJElbJA5y6I5CFjEpbBt6By6 gmNbrrlCcKKQfiRwXud7ok1bvl4GOJrj5IL9x4EgDz2inhs4BWtuJewHrjxFrqwAjaIgKe 06k/G/psunzvgeGvsMjzenFF89b//O/IU/cdcrwurlzOAoPSq4ly7CU0txJxxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705306701; a=rsa-sha256; cv=none; b=LNoxNB8HQHiGm/LO8xq5iA/VWLREZ6NQfanineevsUIW+3+cqQmLQW5hKfJYJN7ArC5S+g yicKvdE4myZdqpuAKnPWWdZqPISwmvWnsd/oL3bz7Y4TUy4miGGfjapTJlD27C0iHZmKbR a7My5iZl2MVPuwaQoE7c4Ntmo4x8gz6AQKbsV/Y50Q7SE8kpJUyuteff6wTknoqNqey4N5 QuEey8bfzowOkzHxB2DDm/Xh6YuhBY6jKBEanZhtnjK44GiN3/qcyQBXXSp1Te3jYYGIwk xI6o1BEmoxMIAx8R89aCDqznav0tlO6PpktMbns3i0NwlsA95ohLKxJHH8IO6g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TD4ld1w88zpyF; Mon, 15 Jan 2024 08:18:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40F8ILYg084872; Mon, 15 Jan 2024 08:18:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40F8ILU4084869; Mon, 15 Jan 2024 08:18:21 GMT (envelope-from git) Date: Mon, 15 Jan 2024 08:18:21 GMT Message-Id: <202401150818.40F8ILU4084869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 04719681ba76 - stable/13 - tcp: prevent spurious empty segments and fix uncommon panic List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 04719681ba76a0756492b42313ea744503b78358 Auto-Submitted: auto-generated The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=04719681ba76a0756492b42313ea744503b78358 commit 04719681ba76a0756492b42313ea744503b78358 Author: Richard Scheffenegger AuthorDate: 2024-01-08 08:25:39 +0000 Commit: Richard Scheffenegger CommitDate: 2024-01-15 05:22:17 +0000 tcp: prevent spurious empty segments and fix uncommon panic Only try sending more data on pure ACKs when there is more data available in the send buffer. In the case of a retransmitted SYN not being sent due to an internal error, the snd_una/snd_nxt accounting could be off, leading to a panic. Pulling snd_nxt up to snd_una prevents this from happening. Reported by: fengdreamer@126.com Reviewed by: cc, tuexen, #transport MFC after: 1 week Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D43343 (cherry picked from commit f4574e2dc5a4719379496338257526aba484751b) --- sys/netinet/tcp_input.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 262e95d08071..af6afbd271bb 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1943,7 +1943,13 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur); sowwakeup(so); - if (sbavail(&so->so_snd)) + /* + * Only call tcp_output when there + * is new data available to be sent + * or we need to send an ACK. + */ + if (SEQ_GT(tp->snd_una + sbavail(&so->so_snd), + tp->snd_max) || tp->t_flags & TF_ACKNOW) (void) tp->t_fb->tfb_tcp_output(tp); goto check_delack; } @@ -2112,6 +2118,8 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN << tp->rcv_scale); tp->snd_una++; /* SYN is acked */ + if (SEQ_LT(tp->snd_nxt, tp->snd_una)) + tp->snd_nxt = tp->snd_una; /* * If not all the data that was sent in the TFO SYN * has been acked, resend the remainder right away.