syzbot


KASAN: use-after-free Read in xlog_cil_push

Status: upstream: reported C repro on 2023/02/26 11:16
Reported-by: syzbot+448a5d3383f4a803befa@syzkaller.appspotmail.com
First crash: 424d, last: 424d

Sample crash report:
XFS (loop3): Quotacheck needed: Please wait.
XFS (loop2): xfs_do_force_shutdown(0x2) called from line 1271 of file fs/xfs/xfs_log.c.  Return address = 00000000c0de336e
XFS (loop2): Log I/O Error Detected.  Shutting down filesystem
XFS (loop2): Please umount the filesystem and rectify the problem(s)
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0xd6/0xf0 lib/list_debug.c:54
Read of size 8 at addr ffff8880add7f318 by task kworker/1:2/4385

CPU: 1 PID: 4385 Comm: kworker/1:2 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023
Workqueue: xfs-cil/loop2 xlog_cil_push_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
 __list_del_entry_valid+0xd6/0xf0 lib/list_debug.c:54
 __list_del_entry include/linux/list.h:117 [inline]
 list_del_init include/linux/list.h:159 [inline]
 xlog_cil_push.isra.0+0x47c/0x1010 fs/xfs/xfs_log_cil.c:715
 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 8109:
 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_getsb+0xab/0x6b0 fs/xfs/xfs_trans_buf.c:210
 xfs_log_sb+0x40/0x190 fs/xfs/libxfs/xfs_sb.c:938
 xfs_qm_qino_alloc+0x3f8/0x950 fs/xfs/xfs_qm.c:814
 xfs_qm_init_quotainos+0x5cd/0x730 fs/xfs/xfs_qm.c:1556
 xfs_qm_init_quotainfo+0x146/0xd70 fs/xfs/xfs_qm.c:659
 xfs_qm_mount_quotas+0x55/0x680 fs/xfs/xfs_qm.c:1432
 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 2836:
 __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_item_unpin+0x4e5/0xab0 fs/xfs/xfs_buf_item.c:480
 xfs_trans_committed_bulk+0x181/0x6f0 fs/xfs/xfs_trans.c:867
 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

The buggy address belongs to the object at ffff8880add7f2a0
 which belongs to the cache xfs_buf_item of size 272
The buggy address is located 120 bytes inside of
 272-byte region [ffff8880add7f2a0, ffff8880add7f3b0)
The buggy address belongs to the page:
page:ffffea0002b75fc0 count:1 mapcount:0 mapping:ffff88823908cb40 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880b0a12548 ffffea0002ae6488 ffff88823908cb40
raw: 0000000000000000 ffff8880add7f000 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected
XFS (loop1): metadata I/O error in "xlog_iodone" at daddr 0x10000 len 64 error 5

Memory state around the buggy address:
 ffff8880add7f200: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8880add7f280: fc fc fc fc fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880add7f300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff8880add7f380: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fb fb
 ffff8880add7f400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
XFS (loop1): xfs_do_force_shutdown(0x2) called from line 1271 of file fs/xfs/xfs_log.c.  Return address = 00000000c0de336e
XFS (loop1): Log I/O Error Detected.  Shutting down filesystem
XFS (loop1): Please umount the filesystem and rectify the problem(s)

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/26 11:31 linux-4.19.y 3f8a27f9e27b ee50e71c .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 KASAN: use-after-free Read in xlog_cil_push
2023/02/26 11:15 linux-4.19.y 3f8a27f9e27b ee50e71c .config console log report info [disk image] [vmlinux] ci2-linux-4-19 KASAN: use-after-free Read in xlog_cil_push
* Struck through repros no longer work on HEAD.