Subject: Autodetecting ffsv2 and ffsv2
To: None <>
From: David Laight <>
List: tech-kern
Date: 04/12/2003 14:45:47
I have a slight worry over some of the code I've seen that does the
autodetection between ufs/ffs v1 and v2.

The code I found seemed to use the presence of the magic number in
the superblock to determine the fs type.  This is somewhat dangerous
as the superblocks seem to be at different locations.

In particular the v1 superblock is at offest 8k and the v2 at offset 64k.

Now a v1 filesystem could quite easily have a data block at offset 64k
that contains the v2 magic number at the correct offset.

Similarly (especially if newfs doesn't splat the sector) a v2 fs could
have the v1 magic number at offset 8k.

This all seems rather dangerous to me.


David Laight: