syzbot


KASAN: slab-out-of-bounds Write in xlog_cil_push_work

Status: moderation: reported on 2024/06/02 09:23
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+83b9b8ec3e9bb4474fb9@syzkaller.appspotmail.com
First crash: 16d, last: 6d13h

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in __list_splice include/linux/list.h:530 [inline]
BUG: KASAN: slab-out-of-bounds in list_splice_init include/linux/list.h:572 [inline]
BUG: KASAN: slab-out-of-bounds in xlog_cil_push_pcp_aggregate fs/xfs/xfs_log_cil.c:137 [inline]
BUG: KASAN: slab-out-of-bounds in xlog_cil_push_work+0x1d9b/0x21d0 fs/xfs/xfs_log_cil.c:1168
Write of size 8 at addr ffff88802a084507 by task kworker/u32:2/45

CPU: 3 PID: 45 Comm: kworker/u32:2 Not tainted 6.10.0-rc1-syzkaller-00021-ge0cce98fe279 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: xfs-cil/loop0 xlog_cil_push_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0xc3/0x620 mm/kasan/report.c:488
 kasan_report+0xd9/0x110 mm/kasan/report.c:601
 __list_splice include/linux/list.h:530 [inline]
 list_splice_init include/linux/list.h:572 [inline]
 xlog_cil_push_pcp_aggregate fs/xfs/xfs_log_cil.c:137 [inline]
 xlog_cil_push_work+0x1d9b/0x21d0 fs/xfs/xfs_log_cil.c:1168
 process_one_work+0x958/0x1ad0 kernel/workqueue.c:3231
 process_scheduled_works kernel/workqueue.c:3312 [inline]
 worker_thread+0x6c8/0xf70 kernel/workqueue.c:3393
 kthread+0x2c1/0x3a0 kernel/kthread.c:389
 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Allocated by task 6524:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 unpoison_slab_object mm/kasan/common.c:312 [inline]
 __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:338
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slub.c:3940 [inline]
 slab_alloc_node mm/slub.c:4000 [inline]
 kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4007
 xfs_inode_item_init+0x24/0xc0 fs/xfs/xfs_inode_item.c:838
 xfs_trans_ijoin+0xfc/0x160 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_init_new_inode+0x881/0x1870 fs/xfs/xfs_inode.c:881
 xfs_qm_qino_alloc+0x244/0x6b0 fs/xfs/xfs_qm.c:800
 xfs_qm_init_quotainos+0x57b/0x6d0 fs/xfs/xfs_qm.c:1601
 xfs_qm_init_quotainfo+0xf8/0xac0 fs/xfs/xfs_qm.c:643
 xfs_qm_mount_quotas+0x59/0x650 fs/xfs/xfs_qm.c:1477
 xfs_mountfs+0x1b72/0x1e80 fs/xfs/xfs_mount.c:980
 xfs_fs_fill_super+0x1434/0x1df0 fs/xfs/xfs_super.c:1753
 get_tree_bdev+0x36f/0x610 fs/super.c:1615
 vfs_get_tree+0x8f/0x380 fs/super.c:1780
 do_new_mount fs/namespace.c:3352 [inline]
 path_mount+0x6e1/0x1f10 fs/namespace.c:3679
 do_mount fs/namespace.c:3692 [inline]
 __do_sys_mount fs/namespace.c:3898 [inline]
 __se_sys_mount fs/namespace.c:3875 [inline]
 __ia32_sys_mount+0x295/0x320 fs/namespace.c:3875
 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
 __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e

The buggy address belongs to the object at ffff88802a0843d8
 which belongs to the cache xfs_ili of size 264
The buggy address is located 39 bytes to the right of
 allocated 264-byte region [ffff88802a0843d8, ffff88802a0844e0)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802a084520 pfn:0x2a084
head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffefff(slab)
raw: 00fff00000000040 ffff8880196f3b80 dead000000000122 0000000000000000
raw: ffff88802a084520 0000000080180014 00000001ffffefff 0000000000000000
head: 00fff00000000040 ffff8880196f3b80 dead000000000122 0000000000000000
head: ffff88802a084520 0000000080180014 00000001ffffefff 0000000000000000
head: 00fff00000000001 ffffea0000a82101 ffffffffffffffff 0000000000000000
head: ffff888000000002 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 1, migratetype Reclaimable, gfp_mask 0x1d2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 5393, tgid 5392 (syz-executor.1), ts 55333370466, free_ts 51671300773
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1468
 prep_new_page mm/page_alloc.c:1476 [inline]
 get_page_from_freelist+0x136a/0x2df0 mm/page_alloc.c:3402
 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4660
 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
 alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
 alloc_slab_page+0x56/0x110 mm/slub.c:2264
 allocate_slab mm/slub.c:2427 [inline]
 new_slab+0x84/0x260 mm/slub.c:2480
 ___slab_alloc+0xdac/0x1870 mm/slub.c:3666
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3756
 __slab_alloc_node mm/slub.c:3809 [inline]
 slab_alloc_node mm/slub.c:3988 [inline]
 kmem_cache_alloc_noprof+0x2ae/0x2f0 mm/slub.c:4007
 xfs_inode_item_init+0x24/0xc0 fs/xfs/xfs_inode_item.c:838
 xfs_trans_ijoin+0xfc/0x160 fs/xfs/libxfs/xfs_trans_inode.c:36
 xfs_init_new_inode+0x881/0x1870 fs/xfs/xfs_inode.c:881
 xfs_qm_qino_alloc+0x244/0x6b0 fs/xfs/xfs_qm.c:800
 xfs_qm_init_quotainos+0x57b/0x6d0 fs/xfs/xfs_qm.c:1601
 xfs_qm_init_quotainfo+0xf8/0xac0 fs/xfs/xfs_qm.c:643
 xfs_qm_mount_quotas+0x59/0x650 fs/xfs/xfs_qm.c:1477
 xfs_mountfs+0x1b72/0x1e80 fs/xfs/xfs_mount.c:980
page last free pid 5324 tgid 5324 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1088 [inline]
 free_unref_page+0x64a/0xe40 mm/page_alloc.c:2565
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slub.c:3940 [inline]
 slab_alloc_node mm/slub.c:4000 [inline]
 kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4007
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:139
 getname_flags+0x9b/0xf0 include/linux/audit.h:322
 vfs_fstatat+0x9a/0x150 fs/stat.c:303
 __do_sys_newfstatat+0xa6/0x130 fs/stat.c:468
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff88802a084400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88802a084480: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
>ffff88802a084500: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88802a084580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802a084600: fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/29 09:19 upstream e0cce98fe279 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-out-of-bounds Write in xlog_cil_push_work
2024/06/08 14:38 upstream dc772f8237f9 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: use-after-free Write in xlog_cil_push_work
2024/05/30 05:16 upstream 4a4be1ad3a6e c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 general protection fault in xlog_cil_push_work
* Struck through repros no longer work on HEAD.