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" <hannken%eis.cs.tu-bs.de@localhost>
To: Maxime Villard <max%M00nBSD.net@localhost>
Cc: Martin Husemann <martin%duskware.de@localhost>,
 gnats-bugs%NetBSD.org@localhost
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 <max%M00nBSD.net@localhost> wrote:
 
 > Le 22/10/2015 09:37, Martin Husemann a =E9crit :
 >> J. Hannken-Illjes wrote:
 >>=20
 >>> This cgsize test from ffs_superblock_validate() is wrong.  Newfs =
 aligns
 >>> fs_cgsize to fragment size:
 >>>=20
 >>> 	sblock.fs_cgsize =3D ffs_fragroundup(&sblock, CGSIZE(&sblock));
 >>>=20
 >=20
 > And so does ffs_superblock_validate(), doesn't it? Can you elaborate
 > a bit?
 >=20
 >>> All we should test here is
 >>>=20
 >>> 	fs->fs_cgsize >=3D sizeof(struct cg)
 >>> 	fs->fs_cgsize <=3D fs->fs_bsize
 >>=20
 >=20
 > The only bug I can see currently in ffs_vfsops.c is that the =
 superblock
 > 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 - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig (Germany)
 


Home | Main Index | Thread Index | Old Index