From nobody Mon Jun 06 20:12:32 2022 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 0E68A1BD6A3F; Mon, 6 Jun 2022 20:12:34 +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 4LH4R43zDgz3CNH; Mon, 6 Jun 2022 20:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654546352; 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=FIhswcd9pjV0/XTmrP0wBEXKAUyan8mxdLgRqF1JpXs=; b=MWKDh/0SXKfAri2sqEG2rIV/9t1aAfVKxdQT3i95dvzwZMdMiF7LaD57PCAGHpGUOlWqtS jH0WFb4i/hlB/LHf7KqsKkCmcUjRNgSjG2w0RRyB/KPlKXmPFWAPyiNaV4GLuHQ7kmcvQr YrC97g81PLnqmXyRZraD4XuAH1z8rCwqlzP7jnGHl1/+q/0yDB6oI0x2/50dUGLEn+Ib3f a8OXrfkib9wdFRlRN6lTSJDvVuT98qdi5v9vvigfO5bAMjYDokPbNaWQbZ+eEhWg2BuLU/ vOkoTQ+lirqjb8arP9TyKslTO3o8GeijP//2c8RXNQAgE4Foa0it+B+HxUqNDg== 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 64EE54BD0; Mon, 6 Jun 2022 20:12:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 256KCW4x044366; Mon, 6 Jun 2022 20:12:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 256KCWhd044365; Mon, 6 Jun 2022 20:12:32 GMT (envelope-from git) Date: Mon, 6 Jun 2022 20:12:32 GMT Message-Id: <202206062012.256KCWhd044365@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: bc92b6240ddf - stable/11 - tcp: Correctly compute the retransmit length for all 64-bit platforms. 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: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: bc92b6240ddf6ab11813abe439653308da14ee54 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654546352; 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=FIhswcd9pjV0/XTmrP0wBEXKAUyan8mxdLgRqF1JpXs=; b=V2og1sZl/UDrZDFbfC/4Gh28j792JJyowwf6rgz2nMKoAnbnT7hmspUkIX6zq7zK3E7TA1 Aohwa97TqZ9FD/SE4rtDOr+lRMiu88fn79oebP7XfjGfodp1BQHu+lc+LM4ByUr2HqxhSM /80v+Xe2O2jT7Z8i9H1Wq1GPzZejez6LhlInkjXNSa1XmngnA86tkWb+VDPUoBx/x1Ofn6 rJoD4yXTqEJT0aBK85rhFQvwVxuCy9Tm0VeORTRTEqjv/KYtH9Nl5sW/SHa9LuBXX3B1C7 anw7kU4l7uKCiR7+AFYwMuaFX9IdgvYxdeHZiSPxA1mkv/aadDA3/Smo5LT1sA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654546352; a=rsa-sha256; cv=none; b=TMrwIIvPbyeFE4x+sef2bCC4JV9cynLMuHH2XHA9j9DV9emakqBT2advNv7Rvi1OnOg9si XnXj2ajK25ylqohyWv1HeE51SOYLV153VWDKndwwUVMHeM8t0Nr5rLtDXMU94WZP+/RzyE XsYFeE5bzoKmcjyFZ7sH5iGqSilWglxQ/C/CmQR5CEySkr9145coJn6m95GXGGwfLouUkM kUE2Z3E2P4YABmj84nB1YzEUMMf7dqrKgpTEmm8ECToXSygMHk7q8stC7eTWfkGwj9xqIC 8t+Fgg33GiGJgVdGfgde7RvsG1XUsv87ghifmO+LyUCu8E0G+p7xWOlIYiCEyw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=bc92b6240ddf6ab11813abe439653308da14ee54 commit bc92b6240ddf6ab11813abe439653308da14ee54 Author: Hans Petter Selasky AuthorDate: 2022-06-02 18:33:21 +0000 Commit: Hans Petter Selasky CommitDate: 2022-06-06 20:09:38 +0000 tcp: Correctly compute the retransmit length for all 64-bit platforms. When the TCP sequence number subtracted is greater than 2**32 minus the window size, or 2**31 minus the window size, the use of unsigned long as an intermediate variable, may result in an incorrect retransmit length computation on all 64-bit platforms. While at it create a helper macro to facilitate the computation of the difference between two TCP sequence numbers. Differential Revision: https://reviews.freebsd.org/D35388 Reviewed by: rscheff Sponsored by: NVIDIA Networking (cherry picked from commit 28173d49dccb91e50be9c401dbad1da908a5dc75) --- sys/netinet/tcp_output.c | 15 +++++++++------ sys/netinet/tcp_seq.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 53e3623e7616..cd12e2714d72 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -296,13 +296,16 @@ again: */ p = NULL; goto after_sack_rexmit; - } else + } else { /* Can rexmit part of the current hole */ - len = ((long)ulmin(cwin, - tp->snd_recover - p->rxmit)); - } else - len = ((long)ulmin(cwin, p->end - p->rxmit)); - off = p->rxmit - tp->snd_una; + len = ((int32_t)ulmin(cwin, + SEQ_SUB(tp->snd_recover, p->rxmit))); + } + } else { + len = ((int32_t)ulmin(cwin, + SEQ_SUB(p->end, p->rxmit))); + } + off = SEQ_SUB(p->rxmit, tp->snd_una); KASSERT(off >= 0,("%s: sack block to the left of una : %d", __func__, off)); if (len > 0) { diff --git a/sys/netinet/tcp_seq.h b/sys/netinet/tcp_seq.h index ca1adbaaeab6..7a812e17cc54 100644 --- a/sys/netinet/tcp_seq.h +++ b/sys/netinet/tcp_seq.h @@ -41,6 +41,7 @@ #define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) #define SEQ_GT(a,b) ((int)((a)-(b)) > 0) #define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) +#define SEQ_SUB(a,b) ((int)((a)-(b))) #define SEQ_MIN(a, b) ((SEQ_LT(a, b)) ? (a) : (b)) #define SEQ_MAX(a, b) ((SEQ_GT(a, b)) ? (a) : (b))