syzbot


KASAN: use-after-free Read in xfs_qm_dqfree_one

Status: auto-obsoleted due to no activity on 2023/08/13 14:44
Reported-by: syzbot+2661ee9bb0da2d970a8a@syzkaller.appspotmail.com
First crash: 376d, last: 376d
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 498d 508d 22/26 fixed on 2023/02/24 13:50
linux-6.1 KASAN: use-after-free Read in xfs_qm_dqfree_one 1 204d 204d 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 (2) 1 236d 236d 0/3 auto-obsoleted due to no activity on 2023/12/11 13:22

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+0x158/0x1b0 fs/xfs/xfs_qm.c:1608
Read of size 1 at addr ffff0000dc070368 by task syz-executor.0/3117

CPU: 1 PID: 3117 Comm: syz-executor.0 Not tainted 5.15.107-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x174/0x1e4 mm/kasan/report.c:451
 __asan_report_load1_noabort+0x44/0x50 mm/kasan/report_generic.c:306
 xfs_dquot_type fs/xfs/xfs_dquot.h:144 [inline]
 xfs_qm_dqfree_one+0x158/0x1b0 fs/xfs/xfs_qm.c:1608
 xfs_qm_shrink_scan+0x280/0x354 fs/xfs/xfs_qm.c:523
 do_shrink_slab+0x4b4/0x10b0 mm/vmscan.c:758
 shrink_slab+0x1f8/0x894 mm/vmscan.c:918
 drop_slab_node+0xcc/0x170 mm/vmscan.c:953
 drop_slab+0x98/0x140 mm/vmscan.c:963
 drop_caches_sysctl_handler+0x178/0x394 fs/drop_caches.c:66
 proc_sys_call_handler+0x4cc/0x7cc fs/proc/proc_sysctl.c:587
 proc_sys_write+0x2c/0x3c fs/proc/proc_sysctl.c:613
 do_iter_readv_writev+0x420/0x5f8
 do_iter_write+0x1b8/0x664 fs/read_write.c:855
 vfs_iter_write+0x88/0xac fs/read_write.c:896
 iter_file_splice_write+0x618/0xc48 fs/splice.c:689
 do_splice_from fs/splice.c:767 [inline]
 direct_splice_actor+0xe4/0x1c0 fs/splice.c:936
 splice_direct_to_actor+0x408/0x9a0 fs/splice.c:891
 do_splice_direct+0x1f4/0x334 fs/splice.c:979
 do_sendfile+0x4bc/0xc70 fs/read_write.c:1249
 __do_sys_sendfile64 fs/read_write.c:1311 [inline]
 __se_sys_sendfile64 fs/read_write.c:1303 [inline]
 __arm64_sys_sendfile64+0x264/0x408 fs/read_write.c:1303
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 3097:
 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+0x8c/0xcc mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x1dc/0x45c mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfs_dquot_alloc+0x48/0x590 fs/xfs/xfs_dquot.c:461
 xfs_qm_dqread+0xc8/0x828 fs/xfs/xfs_dquot.c:686
 xfs_qm_dqget+0x23c/0x790 fs/xfs/xfs_dquot.c:897
 xfs_qm_vop_dqalloc+0x724/0xcfc fs/xfs/xfs_qm.c:1726
 xfs_fileattr_set+0x34c/0x1458 fs/xfs/xfs_ioctl.c:1410
 vfs_fileattr_set+0x70c/0xad4 fs/ioctl.c:700
 do_vfs_ioctl+0x1634/0x2a38
 __do_sys_ioctl fs/ioctl.c:872 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:860
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 4090:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515
 xfs_qm_dqdestroy+0x1ac/0x268 fs/xfs/xfs_dquot.c:60
 xfs_qm_dqpurge+0x474/0x5f8 fs/xfs/xfs_qm.c:177
 xfs_qm_dquot_walk+0x1f0/0x424 fs/xfs/xfs_qm.c:86
 xfs_qm_dqpurge_all fs/xfs/xfs_qm.c:194 [inline]
 xfs_qm_unmount+0x90/0x108 fs/xfs/xfs_qm.c:205
 xfs_unmountfs+0xc8/0x1c8 fs/xfs/xfs_mount.c:1018
 xfs_fs_put_super+0x70/0x250 fs/xfs/xfs_super.c:1090
 generic_shutdown_super+0x130/0x29c fs/super.c:475
 kill_block_super+0x70/0xdc fs/super.c:1405
 deactivate_locked_super+0xb8/0x13c fs/super.c:335
 deactivate_super+0x108/0x128 fs/super.c:366
 cleanup_mnt+0x3c0/0x474 fs/namespace.c:1143
 __cleanup_mnt+0x20/0x30 fs/namespace.c:1150
 task_work_run+0x130/0x1e4 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000dc070350
 which belongs to the cache xfs_dquot of size 720
The buggy address is located 24 bytes inside of
 720-byte region [ffff0000dc070350, ffff0000dc070620)
The buggy address belongs to the page:
page:00000000b161f9e3 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11c070
head:00000000b161f9e3 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 dead000000000122 ffff0000c65b6780
raw: 0000000000000000 0000000080130013 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000dc070200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dc070280: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
>ffff0000dc070300: fc fc fc fc fc fc fc fc fc fc fa fb fb fb fb fb
                                                          ^
 ffff0000dc070380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dc070400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
==================================================================
BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3499 [inline]
BUG: KASAN: double-free or invalid-free in kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515

CPU: 0 PID: 3117 Comm: syz-executor.0 Tainted: G    B             5.15.107-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call trace:
 dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
 kasan_report_invalid_free+0x64/0x94 mm/kasan/report.c:373
 ____kasan_slab_free+0x134/0x164
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515
 xfs_qm_dqdestroy+0x1ac/0x268 fs/xfs/xfs_dquot.c:60
 xfs_qm_dqfree_one+0x124/0x1b0 fs/xfs/xfs_qm.c:1613
 xfs_qm_shrink_scan+0x280/0x354 fs/xfs/xfs_qm.c:523
 do_shrink_slab+0x4b4/0x10b0 mm/vmscan.c:758
 shrink_slab+0x1f8/0x894 mm/vmscan.c:918
 drop_slab_node+0xcc/0x170 mm/vmscan.c:953
 drop_slab+0x98/0x140 mm/vmscan.c:963
 drop_caches_sysctl_handler+0x178/0x394 fs/drop_caches.c:66
 proc_sys_call_handler+0x4cc/0x7cc fs/proc/proc_sysctl.c:587
 proc_sys_write+0x2c/0x3c fs/proc/proc_sysctl.c:613
 do_iter_readv_writev+0x420/0x5f8
 do_iter_write+0x1b8/0x664 fs/read_write.c:855
 vfs_iter_write+0x88/0xac fs/read_write.c:896
 iter_file_splice_write+0x618/0xc48 fs/splice.c:689
 do_splice_from fs/splice.c:767 [inline]
 direct_splice_actor+0xe4/0x1c0 fs/splice.c:936
 splice_direct_to_actor+0x408/0x9a0 fs/splice.c:891
 do_splice_direct+0x1f4/0x334 fs/splice.c:979
 do_sendfile+0x4bc/0xc70 fs/read_write.c:1249
 __do_sys_sendfile64 fs/read_write.c:1311 [inline]
 __se_sys_sendfile64 fs/read_write.c:1303 [inline]
 __arm64_sys_sendfile64+0x264/0x408 fs/read_write.c:1303
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 3097:
 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+0x8c/0xcc mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x74/0x3f4 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x1dc/0x45c mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 xfs_dquot_alloc+0x48/0x590 fs/xfs/xfs_dquot.c:461
 xfs_qm_dqread+0xc8/0x828 fs/xfs/xfs_dquot.c:686
 xfs_qm_dqget+0x23c/0x790 fs/xfs/xfs_dquot.c:897
 xfs_qm_vop_dqalloc+0x724/0xcfc fs/xfs/xfs_qm.c:1726
 xfs_fileattr_set+0x34c/0x1458 fs/xfs/xfs_ioctl.c:1410
 vfs_fileattr_set+0x70c/0xad4 fs/ioctl.c:700
 do_vfs_ioctl+0x1634/0x2a38
 __do_sys_ioctl fs/ioctl.c:872 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:860
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Freed by task 4090:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0xdc/0x3c4 mm/slub.c:3515
 xfs_qm_dqdestroy+0x1ac/0x268 fs/xfs/xfs_dquot.c:60
 xfs_qm_dqpurge+0x474/0x5f8 fs/xfs/xfs_qm.c:177
 xfs_qm_dquot_walk+0x1f0/0x424 fs/xfs/xfs_qm.c:86
 xfs_qm_dqpurge_all fs/xfs/xfs_qm.c:194 [inline]
 xfs_qm_unmount+0x90/0x108 fs/xfs/xfs_qm.c:205
 xfs_unmountfs+0xc8/0x1c8 fs/xfs/xfs_mount.c:1018
 xfs_fs_put_super+0x70/0x250 fs/xfs/xfs_super.c:1090
 generic_shutdown_super+0x130/0x29c fs/super.c:475
 kill_block_super+0x70/0xdc fs/super.c:1405
 deactivate_locked_super+0xb8/0x13c fs/super.c:335
 deactivate_super+0x108/0x128 fs/super.c:366
 cleanup_mnt+0x3c0/0x474 fs/namespace.c:1143
 __cleanup_mnt+0x20/0x30 fs/namespace.c:1150
 task_work_run+0x130/0x1e4 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 do_notify_resume+0x262c/0x32b8 arch/arm64/kernel/signal.c:946
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:133 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:138 [inline]
 el0_svc+0xfc/0x1f0 arch/arm64/kernel/entry-common.c:597
 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

The buggy address belongs to the object at ffff0000dc070350
 which belongs to the cache xfs_dquot of size 720
The buggy address is located 0 bytes inside of
 720-byte region [ffff0000dc070350, ffff0000dc070620)
The buggy address belongs to the page:
page:00000000b161f9e3 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11c070
head:00000000b161f9e3 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 dead000000000122 ffff0000c65b6780
raw: 0000000000000000 0000000080130013 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000dc070200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dc070280: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
>ffff0000dc070300: fc fc fc fc fc fc fc fc fc fc fa fb fb fb fb fb
                                                 ^
 ffff0000dc070380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000dc070400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
syz-executor.0 (3117): drop_caches: 2
syz-executor.0 (3117): drop_caches: 2

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/04/15 14:44 linux-5.15.y 4fdad925aa1a ec410564 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in xfs_qm_dqfree_one
* Struck through repros no longer work on HEAD.