From: Sami Liedes Subject: logfs tries to mount corrupted ext2 (with mount -t auto), crashes Date: Sat, 5 May 2012 01:32:22 +0300 Message-ID: <20120504223222.GC13332@sli.dy.fi> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="uh9ZiVrAOUUm9fzH" To: logfs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Return-path: Received: from smtp-4.hut.fi ([130.233.228.94]:58999 "EHLO smtp-4.hut.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757982Ab2EDWci (ORCPT ); Fri, 4 May 2012 18:32:38 -0400 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --uh9ZiVrAOUUm9fzH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, It seems the logfs filesystem needs some more sanity checks. I have a corrupted (intentionally, using the Berserker toolkit) 10 MiB ext2 filesystem which is not recognized as ext2 and which logfs tries to mount with mount -t auto, leading to a crash on a vanilla 3.3.4 running in kvm x86-64. The corrupted ext2 filesystem actually differs =66rom an excellently working, clean ext2 filesystem by a single bit: ------------------------------------------------------------ $ diff -u <(hd testimg.ext2) <(hd testimg.ext2.89.min) --- /dev/fd/63 2012-05-05 01:24:33.184116801 +0300 +++ /dev/fd/62 2012-05-05 01:24:33.184116801 +0300 @@ -3,7 +3,7 @@ 00000400 00 0a 00 00 00 28 00 00 00 02 00 00 1d 23 00 00 |.....(.......= #..| 00000410 9d 04 00 00 01 00 00 00 00 00 00 00 00 00 00 00 |.............= =2E..| 00000420 00 20 00 00 00 20 00 00 00 05 00 00 fc 12 ac 48 |. ... .......= =2E.H| -00000430 66 4f a4 4f 00 00 26 00 53 ef 01 00 01 00 00 00 |fO.O..&.S....= =2E..| +00000430 66 4f a4 4f 00 00 26 00 53 ed 01 00 01 00 00 00 |fO.O..&.S....= =2E..| 00000440 66 4f a4 4f 00 4e ed 00 00 00 00 00 01 00 00 00 |fO.O.N.......= =2E..| 00000450 00 00 00 00 0b 00 00 00 80 00 00 00 38 00 00 00 |............8= =2E..| 00000460 02 00 00 00 01 00 00 00 17 ca c1 08 7d a3 42 47 |............}= =2EBG| ------------------------------------------------------------ You can get the offending filesystem image at http://sli.dy.fi/~sliedes/berserker/testcases/testimg.ext2.89.crash-logfs and the crash can be reproduced simply by mounting the filesystem with mount $path_to_filesystem /mnt -o errors=3Dcontinue Sami ------------------------------------------------------------ REISERFS warning (device vdb): super-6506 reiserfs_getopt: bad value "conti= nue" for option "errors" EXT3-fs (vdb): error: can't find ext3 filesystem on dev vdb. EXT2-fs (vdb): error: can't find an ext2 filesystem on dev vdb. EXT4-fs (vdb): VFS: Can't find ext4 filesystem cramfs: wrong magic SQUASHFS error: Can't find a SQUASHFS superblock on vdb VFS: Can't find a Minix filesystem V1 | V2 | V3 on device vdb. FAT-fs (vdb): bogus number of reserved sectors FAT-fs (vdb): Can't find a valid FAT filesystem FAT-fs (vdb): bogus number of reserved sectors FAT-fs (vdb): Can't find a valid FAT filesystem BFS-fs: bfs_fill_super(): No BFS filesystem on vdb (magic=3D00000000) hfs: unable to parse mount options hfs: unable to parse mount options. vxfs: WRONG superblock magic VFS: unable to find oldfs superblock on device vdb VFS: could not find a valid V7 on vdb. HPFS: Bad magic ... probably not HPFS NTFS-fs error (device vdb): read_ntfs_boot_sector(): Primary boot sector is= invalid. NTFS-fs error (device vdb): read_ntfs_boot_sector(): Mount option errors=3D= recover not used. Aborting without trying to recover. NTFS-fs error (device vdb): ntfs_fill_super(): Not an NTFS volume. UFS-fs: Invalid option: "errors=3Dcontinue" or missing value wrong mount options INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. Pid: 1419, comm: mount Not tainted 3.3.4 #2 Call Trace: [] __lock_acquire+0x8b5/0x1ba0 [] ? trace_hardirqs_on+0xd/0x10 [] ? _raw_spin_unlock_irq+0x2b/0x40 [] ? wait_for_common+0x122/0x160 [] ? try_to_wake_up+0x160/0x160 [] ? logfs_get_wblocks+0x3d/0x90 [] lock_acquire+0xa1/0x140 [] ? logfs_get_wblocks+0x3d/0x90 [] mutex_lock_nested+0x3a/0x2f0 [] ? logfs_get_wblocks+0x3d/0x90 [] logfs_get_wblocks+0x3d/0x90 [] logfs_sync_fs+0x18/0x40 [] __sync_filesystem+0x5e/0x90 [] sync_filesystem+0x32/0x60 [] logfs_kill_sb+0x27/0xe0 [] deactivate_locked_super+0x45/0x80 [] logfs_mount+0x255/0x710 [] mount_fs+0x1b/0xd0 [] vfs_kern_mount+0x6d/0x110 [] ? _raw_read_unlock+0x26/0x30 [] do_kern_mount+0x4f/0x100 [] do_mount+0x53a/0x840 [] ? __get_free_pages+0x12/0x50 [] ? copy_mount_options+0x35/0x170 [] compat_sys_mount+0xdf/0x260 [] sysenter_dispatch+0x7/0x2a [] ? trace_hardirqs_on_thunk+0x3a/0x3f BUG: unable to handle kernel NULL pointer dereference at (null) IP: [] mutex_lock_nested+0xcb/0x2f0 PGD 6a52067 PUD 5657067 PMD 0 Oops: 0002 [#1] CPU 0 Pid: 1419, comm: mount Not tainted 3.3.4 #2 Bochs Bochs RIP: 0010:[] [] mutex_lock_nested+0xcb= /0x2f0 RSP: 0018:ffff880005639c08 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ffff880006a3ce10 RCX: 0000000000000002 RDX: 00000000ffffffff RSI: ffff880005639c28 RDI: ffff880006a3ce10 RBP: ffff880005639c78 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000003 R12: ffff880006a5a040 R13: 0000000000000246 R14: ffff880005639c28 R15: ffff880006a3ce50 FS: 0000000000000000(0000) GS:ffffffff81c1d000(0063) knlGS:00000000f7562750 CS: 0010 DS: 002b ES: 002b CR0: 000000008005003b CR2: 0000000000000000 CR3: 0000000006a7e000 CR4: 00000000000006b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process mount (pid: 1419, threadinfo ffff880005638000, task ffff880006a5a04= 0) Stack: ffffffff812b421d ffff880005639bb8 0000000000001383 ffff8800069dc800 ffff880006a3ce50 0000000000000000 1111111111111111 ffff880005639c28 ffff880005639c40 ffff8800069dc800 0000000000000000 0000000000000400 Call Trace: [] ? logfs_get_wblocks+0x3d/0x90 [] logfs_get_wblocks+0x3d/0x90 [] logfs_sync_fs+0x18/0x40 [] __sync_filesystem+0x5e/0x90 [] sync_filesystem+0x32/0x60 [] logfs_kill_sb+0x27/0xe0 [] deactivate_locked_super+0x45/0x80 [] logfs_mount+0x255/0x710 [] mount_fs+0x1b/0xd0 [] vfs_kern_mount+0x6d/0x110 [] ? _raw_read_unlock+0x26/0x30 [] do_kern_mount+0x4f/0x100 [] do_mount+0x53a/0x840 [] ? __get_free_pages+0x12/0x50 [] ? copy_mount_options+0x35/0x170 [] compat_sys_mount+0xdf/0x260 [] sysenter_dispatch+0x7/0x2a [] ? trace_hardirqs_on_thunk+0x3a/0x3f Code: f6 e8 aa 8e 94 ff 49 8b 54 24 08 4c 89 f6 48 89 df e8 fa 8f 94 ff 48 = 8b 43 48 ba ff ff ff ff 4c 89 73 48 4c 89 7d b0 48 89 45 b8 <4c> 89 30 89 d= 0 4c 89 65 c0 87 03 83 f8 01 0f 84 f9 00 00 00 48 RIP [] mutex_lock_nested+0xcb/0x2f0 RSP CR2: 0000000000000000 ---[ end trace 30712c04b91b8fd0 ]--- Kernel panic - not syncing: Fatal exception Rebooting in 1 seconds.. ------------------------------------------------------------ --uh9ZiVrAOUUm9fzH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBCgAGBQJPpFj2AAoJEKLT589SE0a00zIP/07C3oHVLdKXjXAYhJAsYhKB GmwbkR8t5air9xa2h6jFbUusdAJuu/I+Wu0boFa7mBw75MleffH0gKmvIaOgi5BT rZFDvQPixs6Gq/N4IkXYaxz2at4xsq6MTXjQKkd7HJzmWzSEPK5ustfV30YJFmUW C2ztDiBcc96nN64Rx+dSjq5zcsspFwSaBrEHndieqlr7ZGvkGuZvl/JAHtwkBBzh m3Riur4ISFtm26rEJICmQcxtvXGK+I0kh/vE72sPdM0FCP41E2f5UwcnxQJKBL4I nkrXHDK74jEmjdye9gMJyFEVb4vn8o+RA3l8oU6z78zl21G+WHclX1zXDnolWrjW P8bRIjiUjSx9TRO08u0x4702BC9GBeZQIdT47Ff9u+4B+NwhvTH82rQ8fLnZSIP+ VR/S0mF+nbOdTBjx5VagbLIj2a0PNGpwcMrs4MzYAerJYODIvfuLB4jWrHajtM88 Y5ACcx868zkS1PwiRiAXIwwXvaQMd5Pu5E4aCr2oSuy1Z+4LFfP7Hg9JJYAUTj8V Lb/geQAhS6htg1TvHvybv01cVnIYKsd5w/OGYM5i+AhubqbMsJyYx3/Ie/eqtyT9 or0Aa4HZ6QQLL5GuIP3KfUAiw5i1WOMtjh+CuziijXn2tnk/WyvQBbt2d4td4+1u lo3VInxqrMovxkvxexNM =jd5E -----END PGP SIGNATURE----- --uh9ZiVrAOUUm9fzH--