KASAN: use-after-free Read in xlog_cil_push

5 views
Skip to first unread message

syzbot

unread,
Feb 26, 2023, 6:16:47 AM2/26/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=15f85474c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=448a5d3383f4a803befa
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)

Unfortunately, I don't have any reproducer for this issue yet.

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

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

XFS (loop4): xfs_do_force_shutdown(0x2) called from line 1271 of file fs/xfs/xfs_log.c. Return address = 000000004c959acb
XFS (loop4): Log I/O Error Detected. Shutting down filesystem
XFS (loop4): 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 ffff8880aad941c8 by task kworker/0:2/3686

CPU: 0 PID: 3686 Comm: kworker/0: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/loop4 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 23453:
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 2837:
__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 ffff8880aad94150
which belongs to the cache xfs_buf_item of size 272
The buggy address is located 120 bytes inside of
272-byte region [ffff8880aad94150, ffff8880aad94260)
The buggy address belongs to the page:
page:ffffea0002ab6500 count:1 mapcount:0 mapping:ffff8882393e13c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea00024dcc08 ffffea00028d2748 ffff8882393e13c0
raw: 0000000000000000 ffff8880aad94000 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880aad94080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880aad94100: 00 00 fc fc fc fc fc fc fc fc fb fb fb fb fb fb
>ffff8880aad94180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880aad94200: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff8880aad94280: fc fc fc fc fb fb fb fb fb fb fb fb 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

unread,
Feb 26, 2023, 6:32:47 AM2/26/23
to syzkaller...@googlegroups.com
syzbot has found a reproducer for 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=16b3af1cc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=448a5d3383f4a803befa
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1139c318c80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12f5a9f7480000
mounted in repro: https://storage.googleapis.com/syzbot-assets/5d0f63e48952/mount_0.gz

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

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:
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)

Reply all
Reply to author
Forward
0 new messages