Date: Tue, 28 Mar 2023 11:35:04 +0200 (CEST) From: freebsd@oldach.net (Helge Oldach) To: mckusick@FreeBSD.org (Kirk McKusick) Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: Re: git: 4660b60a00c3 - stable/13 - Updates to UFS/FFS superblock integrity checks when reading a superblock. Message-ID: <202303280935.32S9Z4gc089454@nuc.oldach.net> In-Reply-To: <202303272347.32RNlJVI080195@gitrepo.freebsd.org> from Kirk McKusick at "27 Mar 2023 23:47:19"
next in thread | previous in thread | raw e-mail | index | archive | help
Kirk McKusick wrote on Tue, 28 Mar 2023 01:47:19 +0200 (CEST): > The branch stable/13 has been updated by mckusick: > > URL: https://cgit.FreeBSD.org/src/commit/?id=4660b60a00c3120ddecd94b3f308d39bcb6d085a > > commit 4660b60a00c3120ddecd94b3f308d39bcb6d085a > Author: Kirk McKusick <mckusick@FreeBSD.org> > AuthorDate: 2023-03-27 23:45:59 +0000 > Commit: Kirk McKusick <mckusick@FreeBSD.org> > CommitDate: 2023-03-27 23:46:40 +0000 > > Updates to UFS/FFS superblock integrity checks when reading a superblock. > > Have to add a check that the computed cylinder group size does not > exceed the block size of the filesystem. > > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D38668 > > (cherry picked from commit 0eabe33087d8cb69ae800daae322f12a8f16bd10) > --- > sys/ufs/ffs/ffs_subr.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c > index d847373a8cde..2f69965aba7e 100644 > --- a/sys/ufs/ffs/ffs_subr.c > +++ b/sys/ufs/ffs/ffs_subr.c > @@ -446,6 +446,7 @@ validate_sblock(struct fs *fs, int isaltsblk) > CHK(fs->fs_old_cgoffset, <, 0, %jd); > CHK2(fs->fs_old_cgoffset, >, 0, ~fs->fs_old_cgmask, <, 0, %jd); > CHK(fs->fs_old_cgoffset * (~fs->fs_old_cgmask), >, fs->fs_fpg, %jd); > + CHK(CGSIZE(fs), >, fs->fs_bsize, %jd); > /* > * If anything has failed up to this point, it is usafe to proceed > * as checks below may divide by zero or make other fatal calculations. > With this check added, my -STABLE VM fails to boot with lots of "UFS2 superblock failed" messages. Trying to repair the (apparently broken) file system by booting kernel.old/kernel single-user yields: root@ / # fsck -y /dev/ufs/latitude UFS2 superblock failed: CGSIZE(fs) (32772) > fs->fs_bsize (32768) Cannot find file system superblock UFS2 superblock failed: CGSIZE(fs) (32772) > fs->fs_bsize (32768) Cannot find file system superblock LOOK FOR ALTERNATE SUPERBLOCKS? no root@ / # Removing the committed extra check and all is fine again. Kind regards Helge
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303280935.32S9Z4gc089454>