Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Apr 2023 00:01:40 GMT
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a2d1957bbcc8 - main - Updates to UFS/FFS superblock integrity checks when reading a superblock.
Message-ID:  <202304300001.33U01e8L090381@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=a2d1957bbcc87b499526df8d99ec7e1ddd2193c0

commit a2d1957bbcc87b499526df8d99ec7e1ddd2193c0
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2023-04-29 18:52:27 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202304300001.33U01e8L090381>