From nobody Mon Jun 06 20:03:48 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 DF0BA1BD4ADD; Mon, 6 Jun 2022 20:03:48 +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 4LH4F05qrLz58P6; Mon, 6 Jun 2022 20:03:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654545828; 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=i4K/YE56tvZBiUBePT2f5pQ0yoTuuV/XY4MPgjXZLNA=; b=QGbNaPx1d5OJ3wwm7FtwNMWhbKX2bKg/kuOHWslbNpxY2VBwF2bUzlC7VoFvvGjH1cJIZ4 dDGArqeaJleH7raGRDQ8IjtjT2Q1k8OSqdW58PK3ghczd+N5OPJctXOzinEdxUfqJLxayM KRj1EUqcS+AsBloPJrLOH8b+9ft1Hi89TsG3VulS6b8NI0lMMWskGpzCZWh45dzbj8duUF z9I6mPIKjbOsp/quJMRIv1yXiPtt5ECxxV2speY6ZU8XONmlb8YchaqdNbMA2ubIh+gDOv mQ1HbeSEQm4LcNWR27MpWQ3M5bbmEkgZEbbyp7MK3t4za8huDw9wLQjkRg9uyA== 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 A2AAD49D7; Mon, 6 Jun 2022 20:03:48 +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 256K3mS1031142; Mon, 6 Jun 2022 20:03:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 256K3m7M031141; Mon, 6 Jun 2022 20:03:48 GMT (envelope-from git) Date: Mon, 6 Jun 2022 20:03:48 GMT Message-Id: <202206062003.256K3m7M031141@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: 7169d3610d1c - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: 7169d3610d1cb2614aeebb8ae51f2da0314d27f2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654545828; 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=i4K/YE56tvZBiUBePT2f5pQ0yoTuuV/XY4MPgjXZLNA=; b=Xlz80zV37IJ5Fq8+rCSdozNApP7Ty1FW5tpXgLYnnVD9DoOD7qWfRM6emclvN9H/dgM+9t 8yM56sx5QwitYZh0ARmHXQPSOBsZlTLykJAYGfmHCXCq3tOhIzAhJMFF6nsPrxUNfp9sEg dxIhJORArRedWRH2NwG29K163DD7Do3reNR3EB2n1Z7FTzTL9Vh92Cf8RICyDwNxSGtaMk 8WzPzj53WQId7fHUIVl+ug08t7L37eOZQxAC6i6HUmoFxhCFgnNB7hJcp+DZv6S1vtQOgx Su8QSfQvCLq2b11ioU4Rp9xMX/sjIRRIlQeHv2d4jdSpG0bkjAHsQL203oYVYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654545828; a=rsa-sha256; cv=none; b=Zuja9Y8acchT/83vA0arcJ7fGN+HNxQ7QikSVDVbRWjrO/i8Lse1eQGwptpWlLaNFjmIwr syOHpCFJZzxGX7r892r2hqprsmJvcqj6ie6xGTOuDYE9aGkgaxffdcK+kV8HHbwu1m1Rrc RojJ6+1DvifPZdQbwN7h+Womk7IhI34JAeGq+fByhup0FbeYGyssJDAomI1zCIzlk/HQfN M/lG1MYx/gG/jk+zNxzHFxs547V8Aa3u/pqY6jP/fCFfJ1k1Kr6NmthsF0jtwvC+UBPHd3 tTgmK3EqcTEzrG8Y4nLsLYeJ3mU3hjzm9+fe90urjNlEwxmMb9xYW+mDtLNFwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=7169d3610d1cb2614aeebb8ae51f2da0314d27f2 commit 7169d3610d1cb2614aeebb8ae51f2da0314d27f2 Author: Hans Petter Selasky AuthorDate: 2022-06-02 18:33:21 +0000 Commit: Hans Petter Selasky CommitDate: 2022-06-06 20:00:58 +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 | 13 ++++++++----- sys/netinet/tcp_seq.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 323d61c3e39a..b486f6250508 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -308,13 +308,16 @@ again: */ p = NULL; goto after_sack_rexmit; - } else + } else { /* Can rexmit part of the current hole */ len = ((int32_t)ulmin(cwin, - tp->snd_recover - p->rxmit)); - } else - len = ((int32_t)ulmin(cwin, p->end - p->rxmit)); - off = p->rxmit - tp->snd_una; + 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 b6e682ec1fe4..c77fd0fa1f6f 100644 --- a/sys/netinet/tcp_seq.h +++ b/sys/netinet/tcp_seq.h @@ -43,6 +43,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))