From nobody Sun Apr 30 00:01:40 2023 X-Original-To: dev-commits-src-main@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 4Q862Y51lyz48RPv; Sun, 30 Apr 2023 00:01:41 +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 4Q862Y1QG8z42HL; Sun, 30 Apr 2023 00:01:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682812901; 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=bPU1g2n7m3TnRqB6GtuoS0kywG2Qaj0CWF9lWUeh+C0=; b=kjKaInDHLXAdimH8aPBwjGbjXF9mmizWyhQYLBqOowOkBnnFAi1yTN7cIEqfWcE2jgbIeH iJ06Jl8gN3sZvbufUme+Bzhgo8AX36Tsi0mgQjQCbEYMkNoe0FJVizuI9Emjd4f+WT6vX5 euXp/VdmKrIalN/BnXxf4JGjrtyIQ0rymT/Q2OidVhh3wvMUZyt1MOb+E1sua36GsaWw3m PswLb6K8do6tR8I1XvkK9PZKiV5FS/EoaRC3rGLqSQPPqXfW3ZvMETX7ye1px7XHev9nY3 Kcglex6XPCoFq2Ianbp+R298aTHr4zUcHGb77hnFfs4tLejN8/0lNiEFdLBIEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682812901; 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=bPU1g2n7m3TnRqB6GtuoS0kywG2Qaj0CWF9lWUeh+C0=; b=eUekc/hkfdtxcCuzO0zlpkyHQQFbtrjS5w6PW1zMtBqBbBAi/EmcTX6iRdGsDPDg178Odc eZ6QGwjyDe8KHgj8R1nf1AMWIG2RuYCb7wZOKqRzt6jATZaV3j9HeTpaZ2ssvyHKFRK65C KS8obzA3BXkU6sPW0EtikxLT0nhHNcVMU+XL/if9ZMFN8zjW5ltjp8tUZ48FLUfr++TTnb Q+S6h/kkir9lAkImy+kddiLlLquKv9yH078v9a1+SkWI9flPzLZEQlDkRiB758UU7Fn/B1 +JGSWIRmaDgeN63ZwIGltTi9wACf5zC4JFixMiK34xPG3CGtufTPahOdsAoKEQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682812901; a=rsa-sha256; cv=none; b=xhkb0EB7IyRjyZbHA5F5Y1MAUrgsa0AQQtavbhbotR6OAGY+N1viUZNfofr12kr8ny+b8T TOTaM0lb7I3dHmO+92RbfPkbTbGJMmc5AW7f1DAFqQlohWi0M57lfmR5v1dMxBByLIbbn6 gqQO78zn3VReObq/m5kChfRd+08OPoYbmj12QXnr95GiZfR2Zl8+3aL9gcf7MHGnOdGkbv 6JpBbSGnt76TOxuolskcbP+MGYuZMwG0lte3mXQWnOyaX219ZLrtjZWFl0pcD8T9K0bsZf YKSweuEtHB+a+J9ZSAzRfpXDCC+ECB0B//HeNCmHDMv1WEIyfBKmROvtdFQHwA== 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 4Q862Y08j2z129s; Sun, 30 Apr 2023 00:01:41 +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 33U01eQP090382; Sun, 30 Apr 2023 00:01:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33U01e8L090381; Sun, 30 Apr 2023 00:01:40 GMT (envelope-from git) Date: Sun, 30 Apr 2023 00:01:40 GMT Message-Id: <202304300001.33U01e8L090381@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: a2d1957bbcc8 - main - Updates to UFS/FFS superblock integrity checks when reading a superblock. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: a2d1957bbcc87b499526df8d99ec7e1ddd2193c0 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=a2d1957bbcc87b499526df8d99ec7e1ddd2193c0 commit a2d1957bbcc87b499526df8d99ec7e1ddd2193c0 Author: Kirk McKusick AuthorDate: 2023-04-29 18:52:27 +0000 Commit: Kirk McKusick CommitDate: 2023-04-30 00:01:18 +0000 Updates to UFS/FFS superblock integrity checks when reading a superblock. Check for an uninitialed (zero valued) fs_maxbsize and set it to its minimum valid size (fs_bsize). Uninitialed fs_maxbsize were left by older versions of makefs(8) and the superblock integrity checks fail when they are found. No legitimate superblocks should fail as a result of these changes. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/ufs/ffs/ffs_subr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c index ba1d8c5c13c9..5b4ad96f4638 100644 --- a/sys/ufs/ffs/ffs_subr.c +++ b/sys/ufs/ffs/ffs_subr.c @@ -514,6 +514,9 @@ validate_sblock(struct fs *fs, int flags) %jd); FCHK(fs->fs_sbsize, >, SBLOCKSIZE, %jd); FCHK(fs->fs_sbsize, <, (signed)sizeof(struct fs), %jd); + /* fix for misconfigured filesystems */ + if (fs->fs_maxbsize == 0) + fs->fs_maxbsize = fs->fs_bsize; FCHK(fs->fs_maxbsize, <, fs->fs_bsize, %jd); FCHK(powerof2(fs->fs_maxbsize), ==, 0, %jd); FCHK(fs->fs_maxbsize, >, FS_MAXCONTIG * fs->fs_bsize, %jd);