syzbot


KASAN: use-after-free Read in xfs_trans_committed_bulk

Status: upstream: reported C repro on 2023/01/18 09:53
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+881b905b3306b163c26d@syzkaller.appspotmail.com
First crash: 695d, last: 653d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in xfs_trans_committed_bulk xfs C 4 649d 711d 0/1 upstream: reported C repro on 2023/01/02 11:47
linux-5.15 KASAN: use-after-free Write in xfs_trans_committed_bulk origin:lts-only C done 42 171d 642d 0/3 upstream: reported C repro on 2023/03/12 11:46
linux-6.1 KASAN: use-after-free Read in xfs_trans_committed_bulk origin:lts-only C done 836 220d 645d 0/3 upstream: reported C repro on 2023/03/09 08:20
upstream BUG: unable to handle kernel paging request in xfs_trans_committed_bulk xfs 1 709d 705d 0/28 auto-obsoleted due to no activity on 2023/04/04 21:10

Sample crash report:
loop0: rw=399361, want=65599, limit=65536
XFS (loop0): metadata I/O error in "xlog_iodone" at daddr 0xffff len 64 error 5
XFS (loop0): xfs_do_force_shutdown(0x2) called from line 1271 of file fs/xfs/xfs_log.c.  Return address = 0000000070c8f89f
XFS (loop0): Quotacheck: Unsuccessful (Error -5): Disabling quotas.
==================================================================
BUG: KASAN: use-after-free in xfs_trans_committed_bulk+0x65f/0x6f0 fs/xfs/xfs_trans.c:855
Read of size 8 at addr ffff8880998f76f8 by task kworker/0:1H/2836

CPU: 0 PID: 2836 Comm: kworker/0:1H Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Workqueue: xfs-log/loop0 xfs_buf_ioend_work
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 xfs_trans_committed_bulk+0x65f/0x6f0 fs/xfs/xfs_trans.c:855
 xlog_cil_committed+0x162/0xec0 fs/xfs/xfs_log_cil.c:585
 xlog_state_do_callback+0x444/0x840 fs/xfs/xfs_log.c:2843
 xfs_log_force_umount+0x2ea/0x460 fs/xfs/xfs_log.c:4029
 xfs_do_force_shutdown+0xa4/0x290 fs/xfs/xfs_fsops.c:499
 xlog_iodone+0x16d/0x210 fs/xfs/xfs_log.c:1271
 xfs_buf_ioend+0x291/0x6e0 fs/xfs/xfs_buf.c:1211
 process_one_work+0x864/0x1570 kernel/workqueue.c:2153
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 30505:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 kmem_zone_alloc+0xc0/0x1e0 fs/xfs/kmem.c:94
 kmem_zone_zalloc fs/xfs/kmem.h:124 [inline]
 xfs_buf_item_init+0x7c/0x500 fs/xfs/xfs_buf_item.c:752
 _xfs_trans_bjoin+0x3f/0x130 fs/xfs/xfs_trans_buf.c:77
 xfs_trans_get_buf_map+0x2d3/0x750 fs/xfs/xfs_trans_buf.c:161
 xfs_trans_get_buf fs/xfs/xfs_trans.h:179 [inline]
 xfs_dquot_disk_alloc+0x7e7/0xc10 fs/xfs/xfs_dquot.c:327
 xfs_qm_dqread_alloc fs/xfs/xfs_dquot.c:533 [inline]
 xfs_qm_dqread+0x61a/0x8c0 fs/xfs/xfs_dquot.c:578
 xfs_qm_dqget+0x16b/0x720 fs/xfs/xfs_dquot.c:786
 xfs_qm_quotacheck_dqadjust+0xa7/0x640 fs/xfs/xfs_qm.c:1072
 xfs_qm_dqusage_adjust+0x561/0x6b0 fs/xfs/xfs_qm.c:1190
 xfs_bulkstat_ag_ichunk fs/xfs/xfs_itable.c:290 [inline]
 xfs_bulkstat+0x80d/0x10a0 fs/xfs/xfs_itable.c:474
 xfs_qm_quotacheck+0x265/0x880 fs/xfs/xfs_qm.c:1326
 xfs_qm_mount_quotas+0x124/0x680 fs/xfs/xfs_qm.c:1445
 xfs_mountfs+0x17e2/0x1bf0 fs/xfs/xfs_mount.c:1001
 xfs_fs_fill_super+0xd0e/0x1540 fs/xfs/xfs_super.c:1720
 mount_bdev+0x2fc/0x3b0 fs/super.c:1158
 mount_fs+0xa3/0x310 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2492 [inline]
 do_mount+0x115c/0x2f50 fs/namespace.c:2822
 ksys_mount+0xcf/0x130 fs/namespace.c:3038
 __do_sys_mount fs/namespace.c:3052 [inline]
 __se_sys_mount fs/namespace.c:3049 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3049
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 30505:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 xfs_buf_do_callbacks+0x73/0x280 fs/xfs/xfs_buf_item.c:1017
 xfs_buf_iodone_callbacks+0x10b/0x1240 fs/xfs/xfs_buf_item.c:1196
 xfs_buf_ioend+0x291/0x6e0 fs/xfs/xfs_buf.c:1211
 __xfs_buf_submit+0x869/0x930 fs/xfs/xfs_buf.c:1511
 xfs_buf_delwri_submit_buffers+0x386/0xab0 fs/xfs/xfs_buf.c:2014
 xfs_buf_delwri_submit+0x86/0x260 fs/xfs/xfs_buf.c:2060
 xfs_qm_quotacheck+0x31f/0x880 fs/xfs/xfs_qm.c:1355
 xfs_qm_mount_quotas+0x124/0x680 fs/xfs/xfs_qm.c:1445
 xfs_mountfs+0x17e2/0x1bf0 fs/xfs/xfs_mount.c:1001
 xfs_fs_fill_super+0xd0e/0x1540 fs/xfs/xfs_super.c:1720
 mount_bdev+0x2fc/0x3b0 fs/super.c:1158
 mount_fs+0xa3/0x310 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2492 [inline]
 do_mount+0x115c/0x2f50 fs/namespace.c:2822
 ksys_mount+0xcf/0x130 fs/namespace.c:3038
 __do_sys_mount fs/namespace.c:3052 [inline]
 __se_sys_mount fs/namespace.c:3049 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3049
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880998f7690
 which belongs to the cache xfs_buf_item of size 272
The buggy address is located 104 bytes inside of
 272-byte region [ffff8880998f7690, ffff8880998f77a0)
The buggy address belongs to the page:
page:ffffea0002663dc0 count:1 mapcount:0 mapping:ffff8882393aa3c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea000299b4c8 ffffea0002ab8d48 ffff8882393aa3c0
raw: 0000000000000000 ffff8880998f7000 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880998f7580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880998f7600: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
>ffff8880998f7680: fc fc fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff8880998f7700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880998f7780: fb fb fb fb fc fc fc fc fc fc fc fc fb fb fb fb
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/18 09:53 linux-4.19.y 3f8a27f9e27b 42660d9e .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/03/01 02:29 linux-4.19.y 3f8a27f9e27b 95aee97a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/02/25 07:40 linux-4.19.y 3f8a27f9e27b ee50e71c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/02/21 02:07 linux-4.19.y 3f8a27f9e27b 2414209c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/02/19 02:21 linux-4.19.y 3f8a27f9e27b bcdf85f8 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/02/13 03:35 linux-4.19.y 3f8a27f9e27b 93e26d60 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/02/05 12:13 linux-4.19.y 3f8a27f9e27b be607b78 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in xfs_trans_committed_bulk
2023/01/18 21:01 linux-4.19.y 3f8a27f9e27b 4620c2d9 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in xfs_trans_committed_bulk
* Struck through repros no longer work on HEAD.