Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Aug 2007 16:28:54 +0200
From:      Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
To:        current@freebsd.org
Subject:   Data corruption with msdosfs (rev. 1.172 of msdosfs_vnops.c)
Message-ID:  <20070804142854.GA24178@rzstud5.rz.uni-karlsruhe.de>

next in thread | raw e-mail | index | archive | help

 Hi,

with rev. 1.172 of msdosfs_vnops.c I see data corruption when reading files
on a FAT 32 file system. (I didn't try write accesses apart from deleting
some files, which worked ok).  The file system is on a IDE disk in an
external USB enclosure and has been created with "newfs_msdos -F 32", IIRC.
I can use it without problems under FreeBSD-current (prior to July 20th),
Windows XP and Linux.

The first 0x2000  (usually, but sometimes it's the first 0x3000) bytes of
a file are ok, but then there are some 4kb-blocks from somewhere else.

Example (hexdump -C of a html file):
00001fb0  3c 64 69 76 20 63 6c 61  73 73 3d 22 66 6c 6f 61  |<div class=3D"=
floa|
00001fc0  74 62 72 6b 22 3e 26 6e  62 73 70 3b 3c 2f 64 69  |tbrk">&nbsp;</=
di|
00001fd0  76 3e 0a 3c 2f 64 69 76  3e 0a 0a 3c 2f 64 69 76  |v>.</div>..</d=
iv|
00001fe0  3e 3c 2f 64 69 76 3e 0a  0a 3c 64 69 76 20 69 64  |></div>..<div =
id|
00001ff0  3d 22 72 77 66 6f 6f 74  22 20 63 6c 61 73 73 3d  |=3D"rwfoot" cl=
ass=3D|
00002000  fe fe fe fe fe fe fe fe  fe fe fe fe fe fe fe fe  |=FE=FE=FE=FE=
=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE|
*
00002120  52 fe fe fe fe fe fe fe  fe fe fe fe fe fe fe fe  |R=FE=FE=FE=FE=
=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE|
00002130  fe fe fe fe fe fe fe fe  fe fe fe fe fe fe fe fe  |=FE=FE=FE=FE=
=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE|
*
00002fd0  fe fe fe fe fe fe fe fe  fe fe fe fe fe fe fe 52  |=FE=FE=FE=FE=
=FE=FE=FE=FE=FE=FE=FE=FE=FE=FE=FER|


Another example:
00002fd0  6d 65 68 72 22 20 74 69  74 6c 65 3d 22 6b 6c 69  |mehr" title=3D=
"kli|
00002fe0  63 6b 20 66 26 75 75 6d  6c 3b 72 20 6d 65 68 72  |ck f&uuml;r me=
hr|
00002ff0  22 2f 3e 3c 2f 61 3e 3c  2f 70 3e 0d 0a 09 09 09  |"/></a></p>...=
..|
00003000  00 00 00 00 00 00 00 00  70 67 5f 73 74 6f 70 00  |........pg_sto=
p.|
00003010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |..............=
..|
00003020  00 00 00 00 00 00 00 00  6d 78 74 61 72 00 00 00  |........mxtar.=
..|
00003030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |..............=
..|
00003040  65 73 64 63 74 6c 00 00  00 00 00 00 00 00 00 00  |esdctl........=
..|
[...]
00007fd0  00 00 00 00 00 00 00 00  68 61 73 68 00 00 00 00  |........hash..=
..|
00007fe0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |..............=
..|
00007ff0  63 6f 6d 70 73 65 74 00  00 00 00 00 00 00 00 00  |compset.......=
..|
00008000  6f 74 65 72 5f 31 22 20  63 6c 61 73 73 3d 22 73  |oter_1" class=
=3D"s|
00008010  69 74 65 6d 61 70 5f 66  6f 6f 74 65 72 22 3e 3c  |itemap_footer"=
><|
00008020  75 6c 3e 3c 6c 69 3e 3c  61 20 68 72 65 66 3d 22  |ul><li><a href=
=3D"|

(From byte 03x000 on there is a list of executables from different
directories, including $HOME/bin. I don't think I have a file where these
names occur so close together, so I suspect this is a block from the zsh
process's heap. The content from byte 0x8000 on to the end was correct.)


This is the disk's partition table:
~#fdisk /dev/da1
******* Working on device /dev/da1 *******
parameters extracted from in-core disklabel are:
cylinders=3D4865 heads=3D255 sectors/track=3D63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=3D4865 heads=3D255 sectors/track=3D63 (16065 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
    start 63, size 78156162 (38162 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 768/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>



Is there any other information I should provide?

Bye
Philipp



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070804142854.GA24178>