syzbot


KASAN: use-after-free Read in xfs_qm_dqfree_one

Status: auto-obsoleted due to no activity on 2024/01/13 12:04
Reported-by: syzbot+37b364c955fa7e6a98d6@syzkaller.appspotmail.com
First crash: 237d, last: 237d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in xfs_qm_dqfree_one xfs syz 7 532d 542d 22/26 fixed on 2023/02/24 13:50
linux-5.15 KASAN: use-after-free Read in xfs_qm_dqfree_one (2) 1 270d 270d 0/3 auto-obsoleted due to no activity on 2023/12/11 13:22
linux-5.15 KASAN: use-after-free Read in xfs_qm_dqfree_one 1 410d 410d 0/3 auto-obsoleted due to no activity on 2023/08/13 14:44

Sample crash report:
XFS (loop0): Ending clean mount
XFS (loop0): Quotacheck needed: Please wait.
XFS (loop0): Quotacheck: Done.
==================================================================
BUG: KASAN: use-after-free in xfs_dquot_type fs/xfs/xfs_dquot.h:136 [inline]
BUG: KASAN: use-after-free in xfs_qm_dqfree_one+0x132/0x170 fs/xfs/xfs_qm.c:1604
Read of size 1 at addr ffff88809a6cc018 by task syz-executor.0/5741

CPU: 0 PID: 5741 Comm: syz-executor.0 Not tainted 6.1.55-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 xfs_dquot_type fs/xfs/xfs_dquot.h:136 [inline]
 xfs_qm_dqfree_one+0x132/0x170 fs/xfs/xfs_qm.c:1604
 xfs_qm_shrink_scan+0x31b/0x3d0 fs/xfs/xfs_qm.c:523
 do_shrink_slab+0x597/0xed0 mm/vmscan.c:846
 shrink_slab+0x237/0x8b0 mm/vmscan.c:1006
 drop_slab_node mm/vmscan.c:1041 [inline]
 drop_slab+0x163/0x290 mm/vmscan.c:1051
 drop_caches_sysctl_handler+0xb3/0x160 fs/drop_caches.c:66
 proc_sys_call_handler+0x541/0x8a0 fs/proc/proc_sysctl.c:604
 do_iter_write+0x6e6/0xc50 fs/read_write.c:861
 iter_file_splice_write+0x806/0xfa0 fs/splice.c:686
 do_splice_from fs/splice.c:764 [inline]
 direct_splice_actor+0xe3/0x1c0 fs/splice.c:931
 splice_direct_to_actor+0x4c0/0xbd0 fs/splice.c:886
 do_splice_direct+0x27f/0x3c0 fs/splice.c:974
 do_sendfile+0x61c/0xff0 fs/read_write.c:1255
 __do_sys_sendfile64 fs/read_write.c:1317 [inline]
 __se_sys_sendfile64+0xfc/0x1e0 fs/read_write.c:1309
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fba1407cae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fba14d040c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007fba1419bf80 RCX: 00007fba1407cae9
RDX: 0000000020000180 RSI: 0000000000000005 RDI: 0000000000000006
RBP: 00007fba140c847a R08: 0000000000000000 R09: 0000000000000000
R10: 000000001eee061c R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fba1419bf80 R15: 00007ffc283f7e88
 </TASK>

Allocated by task 5735:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:679 [inline]
 xfs_dquot_alloc+0x36/0x610 fs/xfs/xfs_dquot.c:475
 xfs_qm_dqread+0xb4/0x6f0 fs/xfs/xfs_dquot.c:659
 xfs_qm_dqget+0x26f/0x4e0 fs/xfs/xfs_dquot.c:870
 xfs_qm_vop_dqalloc+0x59f/0xf60 fs/xfs/xfs_qm.c:1679
 xfs_setattr_nonsize+0x3f7/0x1040 fs/xfs/xfs_iops.c:702
 xfs_vn_setattr+0x2f7/0x340 fs/xfs/xfs_iops.c:1022
 notify_change+0xce3/0xfc0 fs/attr.c:499
 chown_common+0x5aa/0x900 fs/open.c:736
 do_fchownat+0x169/0x240 fs/open.c:767
 __do_sys_lchown fs/open.c:792 [inline]
 __se_sys_lchown fs/open.c:790 [inline]
 __x64_sys_lchown+0x81/0x90 fs/open.c:790
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 3591:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 kmem_cache_free+0x292/0x510 mm/slub.c:3683
 xfs_qm_dqpurge+0x502/0x660 fs/xfs/xfs_qm.c:177
 xfs_qm_dquot_walk+0x22a/0x4a0 fs/xfs/xfs_qm.c:87
 xfs_qm_dqpurge_all fs/xfs/xfs_qm.c:192 [inline]
 xfs_qm_unmount+0x5b/0x100 fs/xfs/xfs_qm.c:205
 xfs_unmountfs+0xc5/0x1e0 fs/xfs/xfs_mount.c:1059
 xfs_fs_put_super+0x6c/0x2c0 fs/xfs/xfs_super.c:1118
 generic_shutdown_super+0x130/0x340 fs/super.c:501
 kill_block_super+0x7a/0xe0 fs/super.c:1459
 deactivate_locked_super+0xa0/0x110 fs/super.c:332
 cleanup_mnt+0x490/0x520 fs/namespace.c:1186
 task_work_run+0x246/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff88809a6cc000
 which belongs to the cache xfs_dquot of size 704
The buggy address is located 24 bytes inside of
 704-byte region [ffff88809a6cc000, ffff88809a6cc2c0)

The buggy address belongs to the physical page:
page:ffffea000269b300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9a6cc
head:ffffea000269b300 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888148aac8c0
raw: 0000000000000000 0000000080130013 00000001ffffffff 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 5735, tgid 5734 (syz-executor.2), ts 311502535636, free_ts 311369434554
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
 prep_new_page mm/page_alloc.c:2540 [inline]
 get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x1a5/0x2d0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:679 [inline]
 xfs_dquot_alloc+0x36/0x610 fs/xfs/xfs_dquot.c:475
 xfs_qm_dqread+0xb4/0x6f0 fs/xfs/xfs_dquot.c:659
 xfs_qm_dqget+0x26f/0x4e0 fs/xfs/xfs_dquot.c:870
 xfs_qm_vop_dqalloc+0x59f/0xf60 fs/xfs/xfs_qm.c:1679
 xfs_setattr_nonsize+0x3f7/0x1040 fs/xfs/xfs_iops.c:702
 xfs_vn_setattr+0x2f7/0x340 fs/xfs/xfs_iops.c:1022
 notify_change+0xce3/0xfc0 fs/attr.c:499
 chown_common+0x5aa/0x900 fs/open.c:736
 do_fchownat+0x169/0x240 fs/open.c:767
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1460 [inline]
 free_pcp_prepare mm/page_alloc.c:1510 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388
 free_unref_page+0x98/0x570 mm/page_alloc.c:3484
 free_large_kmalloc+0xfb/0x190 mm/slab_common.c:932
 kmem_free fs/xfs/kmem.h:62 [inline]
 xlog_write_log_records+0x351/0x3c0 fs/xfs/xfs_log_recover.c:1586
 xlog_clear_stale_blocks+0x2ad/0x430 fs/xfs/xfs_log_recover.c:1711
 xlog_find_tail+0xb2b/0xf80 fs/xfs/xfs_log_recover.c:1365
 xlog_recover+0xd9/0x560 fs/xfs/xfs_log_recover.c:3361
 xfs_log_mount+0x415/0x770 fs/xfs/xfs_log.c:739
 xfs_mountfs+0xcbb/0x1f00 fs/xfs/xfs_mount.c:805
 xfs_fs_fill_super+0xf59/0x11b0 fs/xfs/xfs_super.c:1669
 get_tree_bdev+0x3fe/0x620 fs/super.c:1355
 vfs_get_tree+0x88/0x270 fs/super.c:1562
 do_new_mount+0x28b/0xae0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88809a6cbf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88809a6cbf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809a6cc000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88809a6cc080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809a6cc100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/10/05 12:03 linux-6.1.y d23900f974e0 b7d7ff54 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in xfs_qm_dqfree_one
* Struck through repros no longer work on HEAD.