Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Apr 2019 02:38:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 236977] [msdosfs] returns cached truncated data
Message-ID:  <bug-236977-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236977

            Bug ID: 236977
           Summary: [msdosfs] returns cached truncated data
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

msdosfs does not correctly discard data when a file's size is reduced during
truncate.  The pattern is this:
1) write some data
2) truncate down.  cached data past truncation point should be discarded.
3) truncate back up.
4) read the area between the two truncation points.  It will return the data
written in step 1.

This likely has the same root cause as bug 233783, which affected fusefs.  =
The
solution is likely something similar to r345823.

Steps to Reproduce
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
$ cd /path/to/freebsd/sources/tools/regression/fsx
$ make
$ sudo newfs_msdos /dev/vtbd2
$ sudo mount -t msdosfs /dev/vtbd2 /mnt
$ cd /mnt
$ sudo /usr/obj/whatever/amd64.amd64/tools/regression/fsx/fsx -WR -P /tmp -=
S18
-n fsx.bin
mapped writes DISABLED
Seed set to 18
truncating to largest ever: 0xb023
truncating to largest ever: 0x192cd
truncating to largest ever: 0x3b023
truncating to largest ever: 0x3f621
READ BAD DATA: offset =3D 0x7d2a, size =3D 0x9f4
OFFSET  GOOD    BAD     RANGE
0x 7d2a 0x0000  0x0745  0x  2d6
operation# (mod 256) for the bad data may be 7
LOG DUMP (23 total operations):
1(1 mod 256): TRUNCATE UP       from 0x0 to 0xb023      ******WWWW
2(2 mod 256): TRUNCATE UP       from 0xb023 to 0x192cd
3(3 mod 256): WRITE     0x21da9 thru 0x2efe8    (0xd240 bytes) HOLE
4(4 mod 256): READ      0xa81a thru 0x15033     (0xa81a bytes)
5(5 mod 256): WRITE     0xefe2 thru 0x18cf0     (0x9d0f bytes)
6(6 mod 256): READ      0xc53e thru 0x10ac7     (0x458a bytes)
7(7 mod 256): WRITE     0x228f thru 0xdb4a      (0xb8bc bytes)  ***WWWW
8(8 mod 256): WRITE     0x1f676 thru 0x23936    (0x42c1 bytes)
9(9 mod 256): TRUNCATE DOWN     from 0x2efe9 to 0x5bb5  ******WWWW
10(10 mod 256): TRUNCATE UP     from 0x5bb5 to 0x3b023  ******WWWW
11(11 mod 256): READ    0xd500 thru 0x1443e     (0x6f3f bytes)
12(12 mod 256): TRUNCATE DOWN   from 0x3b023 to 0x32522
13(13 mod 256): WRITE   0x2d8f4 thru 0x32039    (0x4746 bytes)
14(14 mod 256): TRUNCATE DOWN   from 0x32522 to 0x1f921
15(15 mod 256): READ    0xa52a thru 0x1801e     (0xdaf5 bytes)
16(16 mod 256): WRITE   0x37534 thru 0x3be24    (0x48f1 bytes) HOLE
17(17 mod 256): READ    0x9724 thru 0xed9e      (0x567b bytes)
18(18 mod 256): TRUNCATE UP     from 0x3be25 to 0x3f621
19(19 mod 256): READ    0xe5e3 thru 0x15a5c     (0x747a bytes)
20(20 mod 256): TRUNCATE DOWN   from 0x3f621 to 0x23d10
21(21 mod 256): READ    0x15ea7 thru 0x16f2c    (0x1086 bytes)
22(22 mod 256): TRUNCATE DOWN   from 0x23d10 to 0x1a382
23(23 mod 256): READ    0x7d2a thru 0x871d      (0x9f4 bytes)   ***RRRR***
Correct content saved for comparison
(maybe hexdump "fsx.bin" vs "fsx.bin.fsxgood")

--=20
You are receiving this mail because:
You are the assignee for the bug.=



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