From nobody Wed Apr 06 17:46:15 2022 X-Original-To: dev-commits-src-branches@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 60C201AA6D1D; Wed, 6 Apr 2022 17:46:16 +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 4KYX4S0xpyz3Dgf; Wed, 6 Apr 2022 17:46:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649267176; 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=Blg1JHitWEOxFmRcUh1dkk8SsF9bWeZHtoj7ocOcSDc=; b=UJvTaov0WTOdSqPdQ/y3Rml4HqN8vp7welxolN9TYzs02YGiueKMNvlt0me+Hxb71nMVwS 04ZY6YlpYJykOWrtaf38Bnj5srEyNAJE89+YiwKJruR+MrBWLoTzN+M+BbRU26oONuECdp wkVxmEVg+uJ7KxxoN6LGFdj0QMXrWtgZCMlVhuuDss61TlVvg1Tvf+pPw07N0TZrlHI3ZU ylWtlDv1xMyqyITWnTHENHC8sclgzRpNyNWhCcNDX31j0JUeqNepmPBOsSSqiP4QThblnA EOQdidwnaBG5O6d6i0rfc3KkYgvjNQpZgtwvYAi2Yvrbk/ZTsW3UNhcoeFO2Tg== 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 EEB4F1F76C; Wed, 6 Apr 2022 17:46:15 +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 236HkFaV022861; Wed, 6 Apr 2022 17:46:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 236HkFC1022860; Wed, 6 Apr 2022 17:46:15 GMT (envelope-from git) Date: Wed, 6 Apr 2022 17:46:15 GMT Message-Id: <202204061746.236HkFC1022860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 11931e7aa835 - releng/13.1 - fix integer overflow bugs in *stosbt List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 11931e7aa83515e5d33f04cf11e8a3913df61d60 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649267176; 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=Blg1JHitWEOxFmRcUh1dkk8SsF9bWeZHtoj7ocOcSDc=; b=X5vnosteyZXI/gVRDfikgFRc290/FA+i0yFC1L9CopVj/WuAuXygjgsTl6aGj50VsdUKtk rgPaYgrr26UrerZrKgmmd/YZQxL9c5Bxao7Se602Gs0WERX8OV/6mNr9pR5UhLX+TXY8bs OwRX3lGFirWUC2uAGmlsTPR07a8d4fjH4Re6eW7J1g8r0bHlc+KYZZsIzC11RIgyKMpZDL ZW+s3qISH/VEGw824TwX9ASqYGQO59oCWs/ZXZda2SK0z6+F4M/arQLsT/+MXKXP63uGFD yGkVXJMZceSpOlNnuUjv05jvOUtwvjgFVWa2P/6J7/Whv1tq7zHHbK3J8EiNYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649267176; a=rsa-sha256; cv=none; b=sPdxMn9AezWUNIGnrqP+rFfbgs4HVpCDuKpK7Ucaf0tjabdL1OtyE8dPqEzXxvvy0/NAVn YxK7EnPFqMtUueEepxfDI8YLkAepMiezye9xAq1bap977aOmuWu0Ew09yX2HoqR7Y/gAeo v+WN93+88iOqoEC6mVtuGj+VgsDPbZzSVMYmz0TvdPTx/R5YEGbdNswAtEtkv8aqJn9P5E tP2ymOwsTBluNgTOTzNOaETvwfmNoe1b7NEeI/WMwx6r2aUfh84VzQ6OtgM4w0NfomtmlH oH9hucTfY2rLUZdumWKcQHU1A2+sz00v6U2utKA1wfxxg6Nr+SQqhqXMJ4xfKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=11931e7aa83515e5d33f04cf11e8a3913df61d60 commit 11931e7aa83515e5d33f04cf11e8a3913df61d60 Author: Warner Losh AuthorDate: 2022-04-06 03:35:27 +0000 Commit: Warner Losh CommitDate: 2022-04-06 17:46:08 +0000 fix integer overflow bugs in *stosbt 68f57679d660 Fixed another class of integer overflows, but introduced a boundary condition for 2-4s in ns conversion, 2-~4000s in us conversions and 2-~4,000,000s in ms conversions. This was because we bogusly used SBT_1S for the notion of 1 second, instead of the appropriate power of 10. To fix, just use the appropriate power of 10, which avoids these overflows. This caused some sleeps in ZFS to be on the order of an hour. Approved by: re@ (gjb) MFC: 1 day PR: 263073 Sponsored by: Netflix Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D34790 (cherry picked from commit 4c30b9ecd47a2d92565731082a6a4f2bd1e6e051) (cherry picked from commit c43786cc37641cef02171a3c5be5a588d850e6ab) --- sys/sys/time.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/sys/time.h b/sys/sys/time.h index 866a9e788cd0..f3a3bc99a0f2 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -207,7 +207,7 @@ nstosbt(int64_t _ns) #ifdef KASSERT KASSERT(_ns >= 0, ("Negative values illegal for nstosbt: %jd", _ns)); #endif - if (_ns >= SBT_1S) { + if (_ns >= 1000000000) { sb = (_ns / 1000000000) * SBT_1S; _ns = _ns % 1000000000; } @@ -231,7 +231,7 @@ ustosbt(int64_t _us) #ifdef KASSERT KASSERT(_us >= 0, ("Negative values illegal for ustosbt: %jd", _us)); #endif - if (_us >= SBT_1S) { + if (_us >= 1000000) { sb = (_us / 1000000) * SBT_1S; _us = _us % 1000000; } @@ -255,7 +255,7 @@ mstosbt(int64_t _ms) #ifdef KASSERT KASSERT(_ms >= 0, ("Negative values illegal for mstosbt: %jd", _ms)); #endif - if (_ms >= SBT_1S) { + if (_ms >= 1000) { sb = (_ms / 1000) * SBT_1S; _ms = _ms % 1000; }