[xfs?] KASAN: use-after-free Read in xfs_trans_committed_bulk

4 views
Skip to first unread message

syzbot

unread,
Jan 18, 2023, 4:53:44 AM1/18/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12f9ff91480000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=881b905b3306b163c26d
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13c22d19480000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1244c851480000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/98c0bdb4abb3/disk-3f8a27f9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea228ff02669/vmlinux-3f8a27f9.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/a54c30c6de87/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+881b90...@syzkaller.appspotmail.com

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
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages