From nobody Tue Apr 5 20:53:56 2022 X-Original-To: bugs@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 ACC671AA0128 for ; Tue, 5 Apr 2022 20:53:56 +0000 (UTC) (envelope-from bugzilla-noreply@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 4KY0HS3KCgz4hlW for ; Tue, 5 Apr 2022 20:53:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 524A45AE4 for ; Tue, 5 Apr 2022 20:53:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 235KruTr026465 for ; Tue, 5 Apr 2022 20:53:56 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 235KruN8026464 for bugs@FreeBSD.org; Tue, 5 Apr 2022 20:53:56 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 263073] integer overflow in mstosbt, nstosbt and ustosbt Date: Tue, 05 Apr 2022 20:53:56 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.1-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: asomers@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649192036; 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=rL0brjaYAVwdEf3Olql6fS6Pz8UgXxkGWbmL2SrajsY=; b=jaoJWlXt2BUArw7gTWuuooYDBiCqea1jOV+fIcTOummQ7bWoTXZEhaLVSSFZl1Ru+8q7zP oWZ5SYUu8DiNeRwj2u9Z9JXFA+dyX4yBpi66x58DxPlopg0XXckV8q7y1mY42+YxjRH0wk DTTc8xECUhjD+EW+HNPK8WKsqG6QRQflo+OLOoiAGDXY12clGmgtYmG7Uf+GfvBTBVntGO woRPX6kecr+ib6nP5jzKFVj3s0BhshfhCaV/ahtP6CQJPBgCrTKpMV+waclTSoQ+l0a6so nkv40dC459Qkf4vavGcO0MOLYLRwf642ilQEz6+u2aaM6JfEplCx5rvDnqdPHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649192036; a=rsa-sha256; cv=none; b=ndPy+irdVz5d8lfe8z0yK7uNC4+TbgkoGR/KrTQExH619eyk9Xi0X5NF7MP23Wly42ub7e 71WvLWbHwTM6HknadfYYu2gx+xDWlVjBJ9+XKbCgmxEfJuG0fwSf2LhjGGUcQarfqnzE/N dHapLjNIXTkSzg2AotHsJtm2StV62kpvuIXjArssAx4rbEQxBeaikuSfUHTYdRnBQEDtU3 a0BdNniXItX+qQ06DCcCCvduOKvzOKwlyRVqzy01om/1tDwE2n9WrX+uaz3ExFSE3e06cc ByS2uEyERGgepuf9tHOyjujQqEiOwe4q9uF+YI5Ta8ZabWCva7dgs9Hw3hc8kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263073 Bug ID: 263073 Summary: integer overflow in mstosbt, nstosbt and ustosbt Product: Base System Version: 13.1-STABLE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: asomers@FreeBSD.org Attachment #232981 text/plain mime type: Created attachment 232981 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D232981&action= =3Dedit Test case demonstrating the bug, and a solution The Xstosbt functions all contain an integer overflow for input values of 2 seconds or greater. The cause is a comparison against the SBT_1S constant, which was probably intended precisely to prevent such an overflow, but it's= the wrong constant. Instead of "one second in sbintime units", it should be "o= ne second in the input type's units". A visible symptom of this bug is the ZFS's write throttle. On a very heavi= ly loaded system ZFS will sometimes decide to delay a thread by over 2 seconds= .=20 dmu_tx_delay will trigger the overflow in ustosbt, resulting in a delay of = over 4000 seconds instead. Very frustrating! The bug was present in FreeBSD 12, too. But there ZFS's logic was different, so the symptom was that any dela= y of > 2 seconds would turn into a delay of < 2 seconds. Not as noticeable. The bug was introduced in revision 68f57679d66016ba4625f5bf8a99447bbae84fda (SVN r340664). Before that there was a different overflow bug. --=20 You are receiving this mail because: You are the assignee for the bug.=