Bug 199969
Summary: | NULL pointer dereference in xfs_trans_binval() when mounting and operating a crafted xfs image | ||
---|---|---|---|
Product: | File System | Reporter: | Wen Xu (wen.xu) |
Component: | XFS | Assignee: | FileSystem/XFS Default Virtual Assignee (filesystem_xfs) |
Status: | NEW --- | ||
Severity: | normal | CC: | sandeen, wen.xu |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 4.17-rc7 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
The (compressed) crafted image which causes crash
Kernel config |
Description
Wen Xu
2018-06-07 20:36:51 UTC
Created attachment 276373 [details]
The (compressed) crafted image which causes crash
Created attachment 276375 [details]
Kernel config
> - Kernel Message
> [ 330.099346] BUG: unable to handle kernel NULL pointer dereference at
> 00000000000000e8
In general can you please include all messages starting from when the filesystem is mounted? There may be clues there (sure we can reproduce but it's nice to have more info in the bug.)
Thanks,
-Eric
- Full kernel message (4.17-rc7) [ 75.039713] XFS (loop0): Mounting V4 Filesystem [ 75.047205] XFS (loop0): Ending clean mount [ 77.640513] XFS (loop0): xfs_buf_find: daddr 0x22a2a2a28 out of range, EOFS 0x10000 [ 77.642279] WARNING: CPU: 2 PID: 1508 at fs/xfs/xfs_buf.c:602 xfs_buf_find.isra.27+0x463/0x5e0 [ 77.642281] Modules linked in: snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd i2c_piix4 soundcore mac_hid ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi autofs4 raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx raid1 raid0 multipath linear qxl drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm 8139too crct10dif_pclmul crc32_pclmul aesni_intel aes_x86_64 crypto_simd cryptd glue_helper 8139cp mii pata_acpi floppy [ 77.642519] CPU: 2 PID: 1508 Comm: a.out Not tainted 4.17.0-rc7-no-kasan+ #1 [ 77.642521] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 [ 77.642524] RIP: 0010:xfs_buf_find.isra.27+0x463/0x5e0 [ 77.642526] RSP: 0018:ffffa5c04233b828 EFLAGS: 00010292 [ 77.642528] RAX: 0000000000000000 RBX: ffff8babe3eae300 RCX: 0000000000000000 [ 77.642529] RDX: 00000000ffffffc0 RSI: 000000000000000a RDI: ffffffff8c2fdecb [ 77.642531] RBP: ffffa5c04233b8b0 R08: 0000000000000000 R09: 0000000000000000 [ 77.642532] R10: 000000022a2a2a28 R11: f000000000000000 R12: ffff8babe3eae318 [ 77.642533] R13: ffffa5c04233b8c8 R14: 0000000000000001 R15: ffff8babe3eae318 [ 77.642536] FS: 00007f198519b700(0000) GS:ffff8babef280000(0000) knlGS:0000000000000000 [ 77.642538] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 77.642539] CR2: 0000000000d8f008 CR3: 0000000428c3e000 CR4: 00000000000006e0 [ 77.642548] Call Trace: [ 77.642570] xfs_buf_get_map+0x44/0x2c0 [ 77.642582] xfs_trans_get_buf_map+0x11a/0x1a0 [ 77.642592] xfs_da_get_buf+0xbd/0xf0 [ 77.642603] xfs_attr3_leaf_create+0x6b/0x210 [ 77.642607] xfs_attr_shortform_to_leaf+0x18a/0x2f0 [ 77.642609] ? xfs_attr_shortform_to_leaf+0x18a/0x2f0 [ 77.642615] ? kmem_zone_alloc+0x8f/0x110 [ 77.642617] ? kmem_zone_alloc+0x8f/0x110 [ 77.642620] xfs_attr_set+0x3a0/0x4c0 [ 77.642632] xfs_xattr_set+0x4f/0x90 [ 77.642652] ? dput+0x2e/0x140 [ 77.642659] __vfs_setxattr+0x6b/0x90 [ 77.642663] __vfs_setxattr_noperm+0x70/0x1b0 [ 77.642665] vfs_setxattr+0xa7/0xb0 [ 77.642667] setxattr+0x133/0x1b0 [ 77.642686] ? _cond_resched+0x1a/0x50 [ 77.642698] ? kmem_cache_alloc+0x16b/0x1e0 [ 77.642701] ? getname_flags+0x56/0x1f0 [ 77.642704] ? _cond_resched+0x1a/0x50 [ 77.642706] path_setxattr+0xaa/0xe0 [ 77.642708] __x64_sys_setxattr+0x2b/0x30 [ 77.642726] do_syscall_64+0x5a/0x110 [ 77.642732] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 77.642738] RIP: 0033:0x7f1984cbc1fa [ 77.642740] RSP: 002b:00007ffc72d9df78 EFLAGS: 00000206 ORIG_RAX: 00000000000000bc [ 77.642742] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1984cbc1fa [ 77.642743] RDX: 00007ffc72d9dfa0 RSI: 00000000004007a5 RDI: 0000000000d8f080 [ 77.642745] RBP: 00007ffc72d9e020 R08: 0000000000000001 R09: 0000000000000000 [ 77.642746] R10: 0000000000000071 R11: 0000000000000206 R12: 0000000000400550 [ 77.642747] R13: 00007ffc72d9e120 R14: 0000000000000000 R15: 0000000000000000 [ 77.642749] Code: 0f 85 99 01 00 00 48 83 c4 60 5b 41 5c 41 5d 41 5e 41 5f 5d c3 48 89 c1 48 c7 c2 b0 a3 04 8c 48 c7 c6 b0 c2 31 8c e8 1d 8e 01 00 <0f> 0b c7 45 98 8b ff ff ff eb ba 65 8b 05 6b ce c1 74 89 c0 48 [ 77.642783] ---[ end trace 017184b7072d9ba2 ]--- [ 77.642833] BUG: unable to handle kernel NULL pointer dereference at 00000000000000e8 [ 77.644454] PGD 800000042470b067 P4D 800000042470b067 PUD 42b02a067 PMD 0 [ 77.645827] Oops: 0000 [#1] SMP PTI [ 77.646545] Modules linked in: snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd i2c_piix4 soundcore mac_hid ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi autofs4 raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx raid1 raid0 multipath linear qxl drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm 8139too crct10dif_pclmul crc32_pclmul aesni_intel aes_x86_64 crypto_simd cryptd glue_helper 8139cp mii pata_acpi floppy [ 77.655908] CPU: 2 PID: 1508 Comm: a.out Tainted: G W 4.17.0-rc7-no-kasan+ #1 [ 77.657571] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 [ 77.659435] RIP: 0010:xfs_trans_binval+0x16/0x110 [ 77.660388] RSP: 0018:ffffa5c04233b9b0 EFLAGS: 00010292 [ 77.661434] RAX: 0000000000000000 RBX: ffffa5c04233bb60 RCX: 0000000000000001 [ 77.662847] RDX: ffffa5c04233b9fc RSI: 0000000000000000 RDI: ffff8babe69d0000 [ 77.664268] RBP: ffffa5c04233b9d0 R08: 0000000000000001 R09: ffff8babeec03800 [ 77.665682] R10: 0000000000000000 R11: 0000000000000081 R12: ffff8babe69d0000 [ 77.667094] R13: ffff8babe69d0000 R14: 0000000000000000 R15: 0000000000000001 [ 77.668516] FS: 00007f198519b700(0000) GS:ffff8babef280000(0000) knlGS:0000000000000000 [ 77.670118] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 77.671262] CR2: 00000000000000e8 CR3: 0000000428c3e000 CR4: 00000000000006e0 [ 77.672687] Call Trace: [ 77.673193] xfs_da_shrink_inode+0x93/0x170 [ 77.674038] xfs_attr_shortform_to_leaf+0x2b8/0x2f0 [ 77.675015] ? kmem_zone_alloc+0x8f/0x110 [ 77.675832] ? kmem_zone_alloc+0x8f/0x110 [ 77.676642] xfs_attr_set+0x3a0/0x4c0 [ 77.677385] xfs_xattr_set+0x4f/0x90 [ 77.678109] ? dput+0x2e/0x140 [ 77.678731] __vfs_setxattr+0x6b/0x90 [ 77.679472] __vfs_setxattr_noperm+0x70/0x1b0 [ 77.680447] vfs_setxattr+0xa7/0xb0 [ 77.681157] setxattr+0x133/0x1b0 [ 77.681832] ? _cond_resched+0x1a/0x50 [ 77.682592] ? kmem_cache_alloc+0x16b/0x1e0 [ 77.683436] ? getname_flags+0x56/0x1f0 [ 77.684224] ? _cond_resched+0x1a/0x50 [ 77.684986] path_setxattr+0xaa/0xe0 [ 77.685714] __x64_sys_setxattr+0x2b/0x30 [ 77.686525] do_syscall_64+0x5a/0x110 [ 77.687271] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 77.688295] RIP: 0033:0x7f1984cbc1fa [ 77.689021] RSP: 002b:00007ffc72d9df78 EFLAGS: 00000206 ORIG_RAX: 00000000000000bc [ 77.690527] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1984cbc1fa [ 77.691953] RDX: 00007ffc72d9dfa0 RSI: 00000000004007a5 RDI: 0000000000d8f080 [ 77.693371] RBP: 00007ffc72d9e020 R08: 0000000000000001 R09: 0000000000000000 [ 77.694789] R10: 0000000000000071 R11: 0000000000000206 R12: 0000000000400550 [ 77.696217] R13: 00007ffc72d9e120 R14: 0000000000000000 R15: 0000000000000000 [ 77.697635] Code: c3 18 4c 89 e6 e8 eb 89 9d 00 48 8b 03 48 85 c0 75 e8 eb a8 90 66 66 66 66 90 55 48 89 e5 41 56 41 55 49 89 f6 41 54 49 89 fd 53 <4c> 8b a6 e8 00 00 00 66 66 66 66 90 41 f6 84 24 a0 00 00 00 04 [ 77.701383] RIP: xfs_trans_binval+0x16/0x110 RSP: ffffa5c04233b9b0 [ 77.702612] CR2: 00000000000000e8 [ 77.703337] ---[ end trace 017184b7072d9ba3 ]--- Thank you :) (In reply to Eric Sandeen from comment #5) > Thank you :) No problem! I would like to provide any further information or testing. Yep I think you are correct, on this path: error = xfs_attr3_leaf_create(args, blkno, &bp); if (error) { error = xfs_da_shrink_inode(args, 0, bp); xfs_attr3_leaf_create may have errored out w/o ever setting bp based on the blkno being out of range. |