Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: panic while mounting msdosfs
Antti Kantee --> current-users (2008-01-04 02:31:30 +0200):
> On Thu Jan 03 2008 at 23:26:33 +0100, Jukka Salmi wrote:
> > Antti Kantee --> current-users (2008-01-03 18:30:35 +0200):
> > > On Thu Jan 03 2008 at 16:54:07 +0100, Jukka Salmi wrote:
> > > > Hi,
> > > >
> > > > a NetBSD/i386 4.99.47 system reproducibly panics while mounting a msdos
> > > > file system:
> > > >
> > > > $ vnconfig vnd0 /tmp/msdosfs
> > >
> > > Where did the image come from and can you share it?
> >
> > It was on a CF card I got from a friend; it's probably a corrupted
> > file system. And yes, I can share it. I'll contact you off-list.
>
> Ok, first how to analyze it in a slightly easier env:
> rump/fs/bin/msdosfs> ./msdosfs ~/img/msdosfs.img /mnt
> buf mem pool index 23
> Abort (core dumped)
>
> Next, seems like the file system is not FAT enough:
> (gdb) p/x *b710
> $1 = {bpbBytesPerSec = {0x2, 0x0}, bpbSecPerClust = 0x8, bpbResSectors =
> {0x0,
> 0x2}, bpbFATs = 0x2, bpbRootDirEnts = {0x0, 0x0}, bpbSectors = {0x0,
> 0x0},
> bpbMedia = 0xf8, bpbFATsecs = {0x0, 0x0}, bpbSecPerTrack = {0x3f, 0x0},
> bpbHeads = {0xff, 0x0}, bpbHiddenSecs = {0x0, 0x0, 0x0, 0x0},
> bpbHugeSectors = {0xb1, 0xd4, 0x79, 0x0}, bpbBigFATsecs = {0x0, 0x0, 0x0,
> 0x0}, bpbExtFlags = {0x0, 0x0}, bpbFSVers = {0x0, 0x0}, bpbRootClust = {
> 0x0, 0x0, 0x0, 0x0}, bpbFSInfo = {0x0, 0x0}, bpbBackup = {0x0, 0x0},
> bpbReserved = {0x0 <repeats 12 times>}}
>
> bpbBigFATsecs is 0. This means that the file allocation table is 0 bytes
> in size. Not much info will fit into 0 bytes ... Anyway, this causes
> the fs to try to read 0 bytes using bread(). bread() does not like
> being bothered with such trivial tasks and panics the kernel as revenge.
>
> The attached patch (I'll commit it soon) refuses to mount non-fatty FATs:
> rump/fs/bin/msdosfs> ./msdosfs ~/img/msdosfs.img /mnt
> msdosfs: VFS_MOUNT 22
> msdosfs: mount: Invalid argument
>
> I'm curious though, can you try using the file system image on any
> other OS?
Linux is able to mount it (while printing lots of warnings), sees some
directories and files, but trying to read these files results in I/O
errors.
> Index: msdosfs_vfsops.c
> ===================================================================
> RCS file: /cvsroot/src/sys/fs/msdosfs/msdosfs_vfsops.c,v
> retrieving revision 1.57
> diff -p -u -r1.57 msdosfs_vfsops.c
> --- msdosfs_vfsops.c 3 Jan 2008 01:26:28 -0000 1.57
> +++ msdosfs_vfsops.c 4 Jan 2008 00:31:16 -0000
> @@ -638,6 +638,14 @@ msdosfs_mountfs(devvp, mp, l, argp)
> pmp->pm_FATsecs *= tmp;
> SecPerClust *= tmp;
> }
> +
> + /* Check that fs has nonzero FAT size */
> + if (pmp->pm_FATsecs == 0) {
> + DPRINTF(("FATsecs is 0\n"));
> + error = EINVAL;
> + goto error_exit;
> + }
> +
> pmp->pm_fatblk = pmp->pm_ResSectors;
> if (FAT32(pmp)) {
> pmp->pm_rootdirblk = getulong(b710->bpbRootClust);
Thanks!
Regards, Jukka
--
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~
Home |
Main Index |
Thread Index |
Old Index