handle ext3 directory corruption better
Quoted 2 lines
I've been using Steve Grubb's purely evil "fsfuzzer" tool, at
http://people.redhat.com/sgrubb/files/fsfuzzer-0.4.tar.gz
Oops, I didn't know this was going to be mentioned and deleted the file. The current release is 0.5 and I've symlinked it to the address Eric mentioned above. That said, I would like to say a couple things about the program.
Bugs found by fuzzing falls into 2 categories, robustness and security. Its very possible to overflow stacks or find signed/unsigned conversion problems which can be exploited by malicious users. It is also expected by people that the OS tolerate errors. If you have defective media, you may need to access the drive in attempt to salvage what you can. Or maybe someone walks by with specially doctored USB stick and jams it in your desktop computer while you are away. The automounter then mounts and reads the initial directory...boom.
To help find these kind of problems, I worked on a program, fsfuzz, that can create all sorts of errors. The initial idea for the program comes from LMH. The tool saves the image that crashed your machine so that you can replay the problem and study it. This program has killed all the file systems it currently supports in the latest rawhide kernel - except swap. Virtually every file system in the current kernel can be used to oops or lockup a machine. Currently supported filesystems include:
ext2/3
swap
iso9660
vfat/msdos
cramfs
squashfs
xfs
hfs
gfs2
The way that the program works falls into this general pattern, it creates an initial file system image, corrupts it, then loopback mounts it, and tries various operations. If that passes, it corrupts the image in a different way and repeats.
The initial image is created in one of 2 ways, either dd a file or mkdir a directory depending on what the filesystem creation tools call for. To corrupt the image, a version of mangle is used. Mangle is a program that corrupts about 10% of the data and favors bytes with a value > 128 to induce signed/unsigned problems. The corrupted image is exercised by a program called run_test. I separated it from the main program so that you can replay a test and debug what is happening.
So, to wrap up...anyone that has anything to do with file system development may want to give this tool a try to see how robust any given file system is. The program can be grabbed here:
http://people.redhat.com/sgrubb/files/fsfuzzer-0.5.tar.gz
There is a README file that explains more about using it. I am taking patches if you have any ideas about supporting file systems not already covered or ideas for new tests to exercise different filesystem operations.
-Steve
Hi!
Quoted 8 lines
The initial image is created in one of 2 ways, either dd a file or mkdir a directory depending on what the filesystem creation tools call for. To corrupt the image, a version of mangle is used. Mangle is a program that corrupts about 10% of the data and favors bytes with a value > 128 to induce signed/unsigned problems. The corrupted image is exercised by a program called
run_test. I separated it from the main program so that you can replay a test and debug what is happening.
Quoted 5 lines
So, to wrap up...anyone that has anything to do with file system development may want to give this tool a try to see how robust any given file system is. The program can be grabbed here:
Nice... can you run the same tool against fsck, too?
I did that some time ago, with less evil tool, and got some interesting results.
(Expectation is that no matter how you corrupt fs, fsck will get it back to consistent state...)
Pavel
Signature · 1 line
Thanks for all the (sleeping) penguins.
Another expectation is that after the fsck, you won't loose any more data that you could access by mounting the damaged filesystem. There are a lot of horror stories out there of people only having a slightly damaged fs, and after a fsck, they lost a lot more data.
Quoted 9 lines · Pavel Machek
Nice... can you run the same tool against fsck, too?
I did that some time ago, with less evil tool, and got some interesting results.
(Expectation is that no matter how you corrupt fs, fsck will get it back to consistent state...)
Pavel
Quoted 1 line · Pavel Machek
Nice... can you run the same tool against fsck, too?
I'll see if I can make that work, too. The fuzzer tries to preserve the bad image so that you can replay the problem for debugging. I think its just a matter of making another copy and using that one instead.
-Steve
Quoted 6 lines · Steve Grubb
Quoted 1 line · Pavel Machek
Nice... can you run the same tool against fsck, too?
I'll see if I can make that work, too. The fuzzer tries to preserve the bad image so that you can replay the problem for debugging. I think its just a matter of making another copy and using that one instead.
I played with this on xfs a little bit in my spare time, found some xfs_repair problems. :) I'm sure other fs's would have issues as well.
Ideally it would probably be good for the tool to have a "use" mode (try to use the corrupted fs) and a "check" mode (try to fsck the corrupted fs).
In use mode, it'd be: mkfs, fuzz, mount, populate (etc), unmount.
In check mode, it'd be: mkfs, mount, populate, unmount, fuzz, fsck.
-Eric
Hi!
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Nice... can you run the same tool against fsck, too?
I'll see if I can make that work, too. The fuzzer tries to preserve the bad image so that you can replay the problem for debugging. I think its just a matter of making another copy and using that one instead.
I played with this on xfs a little bit in my spare time, found some
xfs_repairproblems. :) I'm sure other fs's would have issues as well.
Yes... I played with similar tool few years ago on ext2, and it lead to fixing couple of bugs in e2fsck, too. vfat/reiser were too buggy for this test to be useful.
Quoted 5 lines
Ideally it would probably be good for the tool to have a "use" mode (try to use the corrupted fs) and a "check" mode (try to fsck the corrupted fs).
In use mode, it'd be: mkfs, fuzz, mount, populate (etc), unmount.
In check mode, it'd be: mkfs, mount, populate, unmount, fuzz, fsck.
Yes, that's what I did back then.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html