From nobody Tue May 09 20:09:10 2023 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 4QG8Pg0BJ8z49R1Q; Tue, 9 May 2023 20:09:11 +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 4QG8Pf6t96z3DRl; Tue, 9 May 2023 20:09:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683662951; 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=pzDsaLVr+EeM4f3Z1l4fbhTep7lnitwQv75BpT3fw4Y=; b=p4GJP8yo13yVRkSe9LXKEtOHmL7R/yxI8PwcWDdxHaLwAMppZcEBPgaV4LHWAJUjIfYxjO d1cT3vuY19gwo9GiC+L4aDspxlA9fd1vFzUPX9h9+jjFSAaMv7LtNtzcUJSAqpIE9+tYY5 eSSEDCQty1cfUdOID2Bl/VZxh5lFzkN6pBFSAFb7KRA/bQuLssPcIWvcHSDKedd6OhvCmp QFc1dCmzFkQI3rCdivSdO+iTc0W0TrHz8t6zKy8A454cuhRzzim0W9I1ofyvFtGp1QY8Uu VlSDANcdylOnYzL41GyNl3exsDpuNquJjkF/UXWuGTMHmQp5BuxyDrBe7iPDmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683662951; 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=pzDsaLVr+EeM4f3Z1l4fbhTep7lnitwQv75BpT3fw4Y=; b=vxe/pNtl3PW+pzXnD+L5F2V95+o9k+WDIudq58CzwkB5sQqMZuQCVqxMCNuKHy2ft4ZKwi H+GRmcFwlXspSzgK3ur4h9+y9Q6SZCupmF7lrMc0aHKtWi8DpWyJJSktacseRSQiPyLEhT yzQ6VyCedVz1/KXJuEV/4dBNACBK3YZja6r59jIh5BVlEJpe1iXfXZ//X0naOyTnit0ids zcdB7/dwccZl+4zPls+tNJhwj1UHFdKx/xeUbbheUDcGeDzzag18OWAnVAu9ld9YAbnC4m jq/MBjparp153Qn9K6TNAWdBaOClMGj7/+cKwcE4k958pZHG8vxLCQqBnXEJFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683662951; a=rsa-sha256; cv=none; b=Ip5dpzuTB3w8AWgDHiTkEe7oWHKEJ4U/46LWRn9B2zV1/N6pOyfOpkEY3mw7532YQCk5te aXP8r4DnCGb9nXmhDR+M7CFZ1fmSg9A6XsWsBIZ9su6k//kE3FwOo2Q+TR8YFkMtdUS5FZ OoViKAkrh3LGApo76Ojj7GOXLuYBdlHOfWZliU0bP9HhZn3ptI4HJsfJkGzqyH0QCXXK3j 8WafU/TIrOxntXq+/m5LBKeV2OPR7GQdi+nrxMav9my5LNQrYKHK7dkrOG6jTj/CNnjleI 8nOHymA0zUN5I+EGTfMw9Lrfl90UuJY3VfunW7hZ+MSoM8nNeaGn6P4h75MjjA== 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 4QG8Pf5yNczhBK; Tue, 9 May 2023 20:09:10 +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 349K9AU5077031; Tue, 9 May 2023 20:09:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 349K9AtK077030; Tue, 9 May 2023 20:09:10 GMT (envelope-from git) Date: Tue, 9 May 2023 20:09:10 GMT Message-Id: <202305092009.349K9AtK077030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kirk McKusick Subject: git: b3fe5d932264 - main - Fix off-by-one error in fsck_ffs(8) chkrange() block-number check. 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: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b3fe5d932264445cbf9a1c4eab01afb6179b499b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=b3fe5d932264445cbf9a1c4eab01afb6179b499b commit b3fe5d932264445cbf9a1c4eab01afb6179b499b Author: Kirk McKusick AuthorDate: 2023-05-09 20:08:10 +0000 Commit: Kirk McKusick CommitDate: 2023-05-09 20:08:10 +0000 Fix off-by-one error in fsck_ffs(8) chkrange() block-number check. On an amd64-CURRENT machine with an i-node that refers to a block number that is one too large will cause a core dump, due to writing beyond the end of blockmap[] and corrupting the next heap block, which happens to contain a struct inoinfo in inphash[]. Note that valgrind catches the blockmap[] access. Reported by: Robert Morris PR: 271289 MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sbin/fsck_ffs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c index 04891447254e..00a60157138c 100644 --- a/sbin/fsck_ffs/inode.c +++ b/sbin/fsck_ffs/inode.c @@ -381,8 +381,8 @@ chkrange(ufs2_daddr_t blk, int cnt) { int c; - if (cnt <= 0 || blk <= 0 || blk > maxfsblock || - cnt - 1 > maxfsblock - blk) { + if (cnt <= 0 || blk <= 0 || blk >= maxfsblock || + cnt > maxfsblock - blk) { if (debug) printf("out of range: blk %ld, offset %i, size %d\n", (long)blk, (int)fragnum(&sblock, blk), cnt);