From nobody Sat May 27 19:24:26 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 4QTBYk3p0cz4VCFb; Sat, 27 May 2023 19:24:26 +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 4QTBYk3HmYz49cT; Sat, 27 May 2023 19:24:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685215466; 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=hYAb7yiCnQDXvGsBPKGKIGLWpdiaxJl4d+eOLWBa9Wg=; b=Yfz+X1hom8ApbXBHFWqmePKE0orBLT9F/hgen/ASfoEjqTP+er7xAd7lMSu1+/Sok18tz3 llwI9MGJiarRy4SWrD7YnqHipBxWJ2NasIpRvJaBlviseoxh5N6EJhuiJYqEX4qsp95Vld /UcoEFWlq3r6qQ42SbQ+oChUnlohoh4N5jGqOiJsjdamAjny8fKu+oCON67Qh7YYhdUOYy jh9B5Tq3mJxLsL9mSkV6peCu/KZ/Lfr8jK4Eqn/PKJV195PT+aBzb7eypWa80bE8lWLn2i xX2oLLi6wxNBIMaUIt8kzZEhoewi3tuWSpk5bQAPdhS0LfEfjQDjhVsXugDjSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685215466; 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=hYAb7yiCnQDXvGsBPKGKIGLWpdiaxJl4d+eOLWBa9Wg=; b=euAr96JVWHC1upt6tayGLVQE4kvMy1rKvaJIFIeihRLXlGRO5z9EAmMsAW7eBZzhgOv6op vdy/gRHGqlX4XDY2iIgenyMoMFVCVo2Xgg9eZxKXV+FmrpLtaPDaW5/LjA/dwXAK1YSzLK r6z6SMsC5h1dw+EB1mjZgTduQhKpDOiCu3MeeKtxhKeN4/pd3y1nh6rwEBvjWsk/JW+n9O Ap0Z4MIp7E9yryAxK0WxrwO/gC4TqY1YyM/YWiPd737lEANOTVurVSrjM+0I9ARTzZ48xP IfgS7YqrqQvxf+XSxRI+tQavlsBjIQbYvUqELMelhx2YKFV6rcAGv5CO1F5sKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685215466; a=rsa-sha256; cv=none; b=LlF83F7sJZX3LeCHmGDdh+Y9PmieTa/ZbBV+Y9kpgvS8wlPBYvr3bjG1SDw5y8vm+DD6Y9 ePmBLvcCx5ctlDdFJLCpDSGHt0gXxq9uaKzzfh99LNH3YdP5Nd82l9WeQWlC7+iE17VNzF Ajf5ozhgvjK/T8J5pytYCm+GGZ36ruSV85Glmpz2exrM51axiEvmYzqLCRL8HpR6Wu2FJ6 +Ntt8AHwRF7p4fan1El9ZJ5/zlY0+xhMmmbigUGdWOX6YChAiHNtZdf2kitk9c+urGX/eX aEl6RKvcqmrbqFOW0A8WH7g/c7TCTU4IFgU9kvApJFqUiMQlf/aWZjEq4Vj1lA== 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 4QTBYk26DXz1199; Sat, 27 May 2023 19:24:26 +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 34RJOQo4012172; Sat, 27 May 2023 19:24:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34RJOQtn012171; Sat, 27 May 2023 19:24:26 GMT (envelope-from git) Date: Sat, 27 May 2023 19:24:26 GMT Message-Id: <202305271924.34RJOQtn012171@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: c79a1416955a - main - Updates to UFS/FFS superblock integrity checks when reading a superblock. 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: c79a1416955a260424a5dd2013b114ff864bc926 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=c79a1416955a260424a5dd2013b114ff864bc926 commit c79a1416955a260424a5dd2013b114ff864bc926 Author: Kirk McKusick AuthorDate: 2023-05-27 19:23:39 +0000 Commit: Kirk McKusick CommitDate: 2023-05-27 19:24:11 +0000 Updates to UFS/FFS superblock integrity checks when reading a superblock. Verify that the summary information does not extend past the end of the filesystem. No legitimate superblocks should fail as a result of these changes. Reported-by: Robert Morris PR: 271351 MFC-after: 1 week Sponsored-by: The FreeBSD Foundation --- sys/ufs/ffs/ffs_subr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index 5b4ad96f4638..3959c3a7008b 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -443,7 +443,8 @@ validate_sblock(struct fs *fs, int flags) FCHK(fs->fs_csaddr, <, 0, %jd); FCHK(fs->fs_cssize, !=, fragroundup(fs, fs->fs_ncg * sizeof(struct csum)), %jd); - FCHK(dtog(fs, fs->fs_csaddr), >, fs->fs_ncg, %jd); + FCHK(fs->fs_csaddr + howmany(fs->fs_cssize, fs->fs_fsize), >, + fs->fs_size, %jd); FCHK(fs->fs_csaddr, <, cgdmin(fs, dtog(fs, fs->fs_csaddr)), %jd); FCHK(dtog(fs, fs->fs_csaddr + howmany(fs->fs_cssize, @@ -594,7 +595,8 @@ validate_sblock(struct fs *fs, int flags) FCHK(fs->fs_csaddr, <, 0, %jd); FCHK(fs->fs_cssize, !=, fragroundup(fs, fs->fs_ncg * sizeof(struct csum)), %jd); - FCHK(dtog(fs, fs->fs_csaddr), >, fs->fs_ncg, %jd); + FCHK(fs->fs_csaddr + howmany(fs->fs_cssize, fs->fs_fsize), >, + fs->fs_size, %jd); FCHK(fs->fs_csaddr, <, cgdmin(fs, dtog(fs, fs->fs_csaddr)), %jd); FCHK(dtog(fs, fs->fs_csaddr + howmany(fs->fs_cssize, fs->fs_fsize)), >, dtog(fs, fs->fs_csaddr), %jd);