syzbot


KASAN: use-after-free Read in xfs_qm_dqfree_one (2)

Status: auto-obsoleted due to no activity on 2023/12/11 13:22
Reported-by: syzbot+2d69ca1cc670c5a0550a@syzkaller.appspotmail.com
First crash: 265d, last: 265d
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 527d 536d 22/26 fixed on 2023/02/24 13:50
linux-6.1 KASAN: use-after-free Read in xfs_qm_dqfree_one 1 232d 232d 0/3 auto-obsoleted due to no activity on 2024/01/13 12:04
linux-5.15 KASAN: use-after-free Read in xfs_qm_dqfree_one 1 405d 405d 0/3 auto-obsoleted due to no activity on 2023/08/13 14:44

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in xfs_dquot_type fs/xfs/xfs_dquot.h:144 [inline]
BUG: KASAN: use-after-free in xfs_qm_dqfree_one+0x132/0x170 fs/xfs/xfs_qm.c:1608
Read of size 1 at addr ffff88807f51b518 by task syz-executor.3/27400

CPU: 0 PID: 27400 Comm: syz-executor.3 Not tainted 5.15.130-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/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+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 xfs_dquot_type fs/xfs/xfs_dquot.h:144 [inline]
 xfs_qm_dqfree_one+0x132/0x170 fs/xfs/xfs_qm.c:1608
 xfs_qm_shrink_scan+0x314/0x3d0 fs/xfs/xfs_qm.c:523
 do_shrink_slab+0x542/0xda0 mm/vmscan.c:758
 shrink_slab+0x233/0x960 mm/vmscan.c:918
 drop_slab_node+0xed/0x180 mm/vmscan.c:953
 drop_slab+0x8b/0x120 mm/vmscan.c:963
 drop_caches_sysctl_handler+0xb3/0x160 fs/drop_caches.c:66
 proc_sys_call_handler+0x541/0x8a0 fs/proc/proc_sysctl.c:587
 do_iter_readv_writev+0x594/0x7a0
 do_iter_write+0x1ea/0x760 fs/read_write.c:855
 iter_file_splice_write+0x806/0xfa0 fs/splice.c:689
 do_splice_from fs/splice.c:767 [inline]
 direct_splice_actor+0xe3/0x1c0 fs/splice.c:936
 splice_direct_to_actor+0x500/0xc10 fs/splice.c:891
 do_splice_direct+0x285/0x3d0 fs/splice.c:979
 do_sendfile+0x625/0xff0 fs/read_write.c:1249
 __do_sys_sendfile64 fs/read_write.c:1311 [inline]
 __se_sys_sendfile64+0xfc/0x1e0 fs/read_write.c:1303
 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+0x61/0xcb
RIP: 0033:0x7fdc8e2a0ae9
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:00007fdc8c8220c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007fdc8e3bff80 RCX: 00007fdc8e2a0ae9
RDX: 0000000020002080 RSI: 0000000000000003 RDI: 0000000000000004
RBP: 00007fdc8e2ec47a R08: 0000000000000000 R09: 0000000000000000
R10: 000000001eee061f R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fdc8e3bff80 R15: 00007fff53eb54e8
 </TASK>

Allocated by task 27360:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfs_dquot_alloc+0x36/0x610 fs/xfs/xfs_dquot.c:461
 xfs_qm_dqread+0xc3/0x770 fs/xfs/xfs_dquot.c:686
 xfs_qm_dqget+0x26f/0x4e0 fs/xfs/xfs_dquot.c:897
 xfs_qm_vop_dqalloc+0x770/0xee0 fs/xfs/xfs_qm.c:1708
 xfs_setattr_nonsize+0x2e9/0xc40 fs/xfs/xfs_iops.c:709
 xfs_vn_setattr+0x2f7/0x340 fs/xfs/xfs_iops.c:1050
 notify_change+0xd4d/0x1000 fs/attr.c:489
 chown_common+0x592/0x890 fs/open.c:680
 do_fchownat+0x169/0x240 fs/open.c:711
 __do_sys_lchown fs/open.c:736 [inline]
 __se_sys_lchown fs/open.c:734 [inline]
 __x64_sys_lchown+0x81/0x90 fs/open.c:734
 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+0x61/0xcb

The buggy address belongs to the object at ffff88807f51b500
 which belongs to the cache xfs_dquot of size 720
The buggy address is located 24 bytes inside of
 720-byte region [ffff88807f51b500, ffff88807f51b7d0)
The buggy address belongs to the page:
page:ffffea0001fd4600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807f519090 pfn:0x7f518
head:ffffea0001fd4600 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001eb7400 0000000200000002 ffff888146b04c80
raw: ffff88807f519090 000000008013000b 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 10554, ts 600103820736, free_ts 598360122897
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfs_dquot_alloc+0x36/0x610 fs/xfs/xfs_dquot.c:461
 xfs_qm_dqread+0xc3/0x770 fs/xfs/xfs_dquot.c:686
 xfs_qm_set_defquota+0xaa/0x330 fs/xfs/xfs_qm.c:550
 xfs_qm_init_quotainfo+0x559/0x970 fs/xfs/xfs_qm.c:682
 xfs_qm_mount_quotas+0x90/0x610 fs/xfs/xfs_qm.c:1428
 xfs_mountfs+0x162b/0x1ca0 fs/xfs/xfs_mount.c:904
 xfs_fs_fill_super+0xfd4/0x1210 fs/xfs/xfs_super.c:1658
 get_tree_bdev+0x3fe/0x620 fs/super.c:1312
 vfs_get_tree+0x88/0x270 fs/super.c:1517
 do_new_mount+0x28b/0xae0 fs/namespace.c:2994
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page_list+0x1f7/0x8e0 mm/page_alloc.c:3433
 release_pages+0x1bb9/0x1f40 mm/swap.c:963
 __pagevec_release+0x80/0xf0 mm/swap.c:983
 pagevec_release include/linux/pagevec.h:81 [inline]
 truncate_inode_pages_range+0x48b/0x1290 mm/truncate.c:329
 kill_bdev block/bdev.c:77 [inline]
 blkdev_flush_mapping+0x182/0x340 block/bdev.c:659
 blkdev_put_whole block/bdev.c:690 [inline]
 blkdev_put+0x4f1/0x790 block/bdev.c:954
 deactivate_locked_super+0xa0/0x110 fs/super.c:335
 cleanup_mnt+0x44e/0x500 fs/namespace.c:1143
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff88807f51b400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807f51b480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807f51b500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88807f51b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807f51b600: 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/09/02 13:22 linux-5.15.y 8f790700c974 696ea0d2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xfs_qm_dqfree_one
* Struck through repros no longer work on HEAD.