syzbot


KASAN: slab-use-after-free Read in xfs_qm_dquot_logitem_unpin (2)

Status: auto-obsoleted due to no activity on 2024/09/24 07:51
Subsystems: xfs
[Documentation on labels]
Reported-by: syzbot+4e2924b0deaa4c908eef@syzkaller.appspotmail.com
First crash: 232d, last: 202d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in xfs_qm_dquot_logitem_unpin xfs 1 511d 507d 0/28 auto-obsoleted due to no activity on 2023/11/20 17:42

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline]
BUG: KASAN: slab-use-after-free in do_raw_spin_lock+0x271/0x2c0 kernel/locking/spinlock_debug.c:115
Read of size 4 at addr ffff8880285e79b4 by task kworker/3:0H/36

CPU: 3 PID: 36 Comm: kworker/3:0H Not tainted 6.10.0-rc5-syzkaller-00018-g55027e689933 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: xfs-log/loop3 xlog_ioend_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
 debug_spin_lock_before kernel/locking/spinlock_debug.c:86 [inline]
 do_raw_spin_lock+0x271/0x2c0 kernel/locking/spinlock_debug.c:115
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline]
 _raw_spin_lock_irqsave+0x42/0x60 kernel/locking/spinlock.c:162
 __wake_up_common_lock kernel/sched/wait.c:105 [inline]
 __wake_up+0x1c/0x60 kernel/sched/wait.c:127
 xfs_qm_dquot_logitem_unpin+0x81/0x90 fs/xfs/xfs_dquot_item.c:96
 xfs_log_item_batch_insert fs/xfs/xfs_trans.c:746 [inline]
 xfs_trans_committed_bulk+0x744/0x890 fs/xfs/xfs_trans.c:850
 xlog_cil_committed+0x161/0x840 fs/xfs/xfs_log_cil.c:736
 xlog_cil_process_committed+0x123/0x1f0 fs/xfs/xfs_log_cil.c:768
 xlog_state_do_iclog_callbacks fs/xfs/xfs_log.c:2791 [inline]
 xlog_state_do_callback+0x562/0xd90 fs/xfs/xfs_log.c:2816
 xlog_ioend_work+0x92/0x110 fs/xfs/xfs_log.c:1398
 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 10937:
 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:3941 [inline]
 slab_alloc_node mm/slub.c:4001 [inline]
 kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4008
 xfs_dquot_alloc+0x2a/0x670 fs/xfs/xfs_dquot.c:497
 xfs_qm_dqread+0x8e/0x5f0 fs/xfs/xfs_dquot.c:683
 xfs_qm_dqget+0x151/0x4a0 fs/xfs/xfs_dquot.c:901
 xfs_qm_scall_setqlim+0x172/0x1980 fs/xfs/xfs_qm_syscalls.c:300
 xfs_fs_set_dqblk+0x166/0x1e0 fs/xfs/xfs_quotaops.c:267
 quota_setquota+0x4c5/0x5f0 fs/quota/quota.c:310
 do_quotactl+0xb00/0x1380 fs/quota/quota.c:802
 __do_sys_quotactl fs/quota/quota.c:961 [inline]
 __se_sys_quotactl fs/quota/quota.c:917 [inline]
 __ia32_sys_quotactl+0x1bb/0x450 fs/quota/quota.c:917
 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

Freed by task 111:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
 poison_slab_object+0xf7/0x160 mm/kasan/common.c:240
 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2196 [inline]
 slab_free mm/slub.c:4437 [inline]
 kmem_cache_free+0x12f/0x3a0 mm/slub.c:4512
 xfs_qm_shrink_scan+0x25c/0x3f0 fs/xfs/xfs_qm.c:531
 do_shrink_slab+0x44f/0x11c0 mm/shrinker.c:435
 shrink_slab+0x18a/0x1310 mm/shrinker.c:662
 shrink_one+0x493/0x7c0 mm/vmscan.c:4790
 shrink_many mm/vmscan.c:4851 [inline]
 lru_gen_shrink_node+0x89f/0x1750 mm/vmscan.c:4951
 shrink_node mm/vmscan.c:5910 [inline]
 kswapd_shrink_node mm/vmscan.c:6720 [inline]
 balance_pgdat+0x1105/0x1970 mm/vmscan.c:6911
 kswapd+0x5ea/0xbf0 mm/vmscan.c:7180
 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

The buggy address belongs to the object at ffff8880285e7740
 which belongs to the cache xfs_dquot of size 704
The buggy address is located 628 bytes inside of
 freed 704-byte region [ffff8880285e7740, ffff8880285e7a00)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880285e6d80 pfn:0x285e4
head: order:2 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 ffff88801b330280 dead000000000122 0000000000000000
raw: ffff8880285e6d80 000000008013000a 00000001ffffefff 0000000000000000
head: 00fff00000000040 ffff88801b330280 dead000000000122 0000000000000000
head: ffff8880285e6d80 000000008013000a 00000001ffffefff 0000000000000000
head: 00fff00000000002 ffffea0000a17901 ffffffffffffffff 0000000000000000
head: 0000000000000004 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5337, tgid 5335 (syz-executor.2), ts 60152096132, free_ts 60150156453
 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/0x2e50 mm/page_alloc.c:3420
 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4678
 __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:2265
 allocate_slab mm/slub.c:2428 [inline]
 new_slab+0x84/0x260 mm/slub.c:2481
 ___slab_alloc+0xdac/0x1870 mm/slub.c:3667
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3757
 __slab_alloc_node mm/slub.c:3810 [inline]
 slab_alloc_node mm/slub.c:3989 [inline]
 kmem_cache_alloc_noprof+0x2ae/0x2f0 mm/slub.c:4008
 xfs_dquot_alloc+0x2a/0x670 fs/xfs/xfs_dquot.c:497
 xfs_qm_dqread+0x8e/0x5f0 fs/xfs/xfs_dquot.c:683
 xfs_qm_dqget_uncached+0xbc/0x160 fs/xfs/xfs_dquot.c:940
 xfs_qm_init_timelimits+0x153/0x390 fs/xfs/xfs_qm.c:600
 xfs_qm_init_quotainfo+0x559/0xac0 fs/xfs/xfs_qm.c:674
 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
page last free pid 34 tgid 34 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:2583
 stack_depot_save_flags+0x2da/0x900 lib/stackdepot.c:666
 kasan_save_stack+0x42/0x60 mm/kasan/common.c:48
 kasan_save_track+0x14/0x30 mm/kasan/common.c:68
 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579
 poison_slab_object+0xf7/0x160 mm/kasan/common.c:240
 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2196 [inline]
 slab_free mm/slub.c:4437 [inline]
 kmem_cache_free+0x12f/0x3a0 mm/slub.c:4512
 bvec_free+0xe0/0x120 block/bio.c:169
 bio_free+0xaa/0x130 block/bio.c:236
 bio_put_percpu_cache block/bio.c:800 [inline]
 bio_put+0x355/0x5b0 block/bio.c:819
 bio_endio+0x644/0x760 block/bio.c:1636
 blk_update_request+0x704/0x1850 block/blk-mq.c:929
 blk_mq_end_request+0x5b/0x620 block/blk-mq.c:1057
 lo_complete_rq+0x232/0x2f0 drivers/block/loop.c:389
 blk_complete_reqs+0xae/0xf0 block/blk-mq.c:1132

Memory state around the buggy address:
 ffff8880285e7880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880285e7900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880285e7980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff8880285e7a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880285e7a80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/26 07:50 upstream 55027e689933 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in xfs_qm_dquot_logitem_unpin
2024/06/03 06:46 upstream c3f38fa61af7 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in xfs_qm_dquot_logitem_unpin
2024/05/27 18:48 upstream 2bfcfd584ff5 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in xfs_qm_dquot_logitem_unpin
* Struck through repros no longer work on HEAD.