NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/50070: fsck OK but mount: incorrect super block

The following reply was made to PR kern/50070; it has been noted by GNATS.

From: "J. Hannken-Illjes" <>
To: Maxime Villard <>
Cc: Martin Husemann <>,
Subject: Re: kern/50070: fsck OK but mount: incorrect super block
Date: Thu, 22 Oct 2015 12:02:35 +0200

 On 22 Oct 2015, at 10:24, Maxime Villard <> wrote:
 > Le 22/10/2015 09:37, Martin Husemann a =E9crit :
 >> J. Hannken-Illjes wrote:
 >>> This cgsize test from ffs_superblock_validate() is wrong.  Newfs =
 >>> fs_cgsize to fragment size:
 >>> 	sblock.fs_cgsize =3D ffs_fragroundup(&sblock, CGSIZE(&sblock));
 > And so does ffs_superblock_validate(), doesn't it? Can you elaborate
 > a bit?
 >>> All we should test here is
 >>> 	fs->fs_cgsize >=3D sizeof(struct cg)
 >>> 	fs->fs_cgsize <=3D fs->fs_bsize
 > The only bug I can see currently in ffs_vfsops.c is that the =
 > is validated before ffs_oldfscompat_read() is called, which means that
 > FFSv1+!FS_FLAGS_UPDATED disks may not mount correctly. This is not the
 > case in that PR, since "fslevel 4" means FFSv1+FS_FLAGS_UPDATED.
 As already noted in this PR the first bug is to assume CGSIZE() returns
 an exact value.  It is just a guess, newfs(8) uses it as a starting
 point and reduces it to be less than fs_bsize.
 We will read cylinder groups with size fs_cgsize so this value has to
 be greater than sizeof(cg) and less or equal fs_bsize.
 If we want to check the cylinder groups, we have to check the pointers
 from struct cg against fs_cgsize and we have to do this check on every
 call to cg_chkmagic().
 J. Hannken-Illjes - - TU Braunschweig (Germany)

Home | Main Index | Thread Index | Old Index