loop1: detected capacity change from 0 to 2048 ================================================================== BUG: KASAN: use-after-free in nilfs_mdt_destroy+0x4f/0x70 fs/nilfs2/mdt.c:497 Read of size 8 at addr ffff8880782e5098 by task syz-executor.1/10509 CPU: 0 PID: 10509 Comm: syz-executor.1 Not tainted 6.0.0-syzkaller-05118-g833477fce7a1 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106 print_address_description+0x65/0x4b0 mm/kasan/report.c:317 print_report+0x108/0x1f0 mm/kasan/report.c:433 kasan_report+0xc3/0xf0 mm/kasan/report.c:495 nilfs_mdt_destroy+0x4f/0x70 fs/nilfs2/mdt.c:497 nilfs_free_inode+0x44/0x70 fs/nilfs2/super.c:168 i_callback fs/inode.c:249 [inline] alloc_inode fs/inode.c:274 [inline] new_inode_pseudo+0x19a/0x1d0 fs/inode.c:1019 new_inode+0x25/0x1d0 fs/inode.c:1047 nilfs_new_inode+0xca/0x8a0 fs/nilfs2/inode.c:334 nilfs_create+0xdc/0x2d0 fs/nilfs2/namei.c:85 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x12d0/0x2df0 fs/namei.c:3688 do_filp_open+0x264/0x4f0 fs/namei.c:3718 do_sys_openat2+0x124/0x4e0 fs/open.c:1313 do_sys_open fs/open.c:1329 [inline] __do_sys_openat fs/open.c:1345 [inline] __se_sys_openat fs/open.c:1340 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1340 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:0x7fc37ea8a5a9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc37fbaf168 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fc37ebabf80 RCX: 00007fc37ea8a5a9 RDX: 000000000000275a RSI: 0000000020003d80 RDI: ffffffffffffff9c RBP: 00007fc37fbaf1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002 R13: 00007ffe11373dcf R14: 00007fc37fbaf300 R15: 0000000000022000 Allocated by task 6007: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc+0xcd/0x100 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x97/0x310 mm/slub.c:3289 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] kernfs_fop_open+0x3c4/0xc70 fs/kernfs/file.c:680 do_dentry_open+0x777/0x1180 fs/open.c:880 do_open fs/namei.c:3557 [inline] path_openat+0x25fc/0x2df0 fs/namei.c:3691 do_filp_open+0x264/0x4f0 fs/namei.c:3718 do_sys_openat2+0x124/0x4e0 fs/open.c:1313 do_sys_open fs/open.c:1329 [inline] __do_sys_openat fs/open.c:1345 [inline] __se_sys_openat fs/open.c:1340 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1340 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 6007: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x3d/0x60 mm/kasan/common.c:45 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:367 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1759 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1785 slab_free mm/slub.c:3539 [inline] kfree+0xda/0x210 mm/slub.c:4567 kernfs_fop_release+0x28d/0x330 fs/kernfs/file.c:816 __fput+0x3b9/0x820 fs/file_table.c:320 task_work_run+0x146/0x1c0 kernel/task_work.c:177 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x124/0x150 kernel/entry/common.c:169 exit_to_user_mode_prepare+0xb2/0x140 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:294 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 ffff8880782e5000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 152 bytes inside of 512-byte region [ffff8880782e5000, ffff8880782e5200) The buggy address belongs to the physical page: page:ffffea0001e0b900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x782e4 head:ffffea0001e0b900 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888012041c80 raw: 0000000000000000 0000000000100010 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2977, tgid 2977 (udevadm), ts 13625627174, free_ts 11340283741 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x742/0x7c0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549 alloc_slab_page+0x70/0xf0 mm/slub.c:1829 allocate_slab+0x5e/0x520 mm/slub.c:1974 new_slab mm/slub.c:2034 [inline] ___slab_alloc+0x3ee/0xc40 mm/slub.c:3036 __slab_alloc mm/slub.c:3123 [inline] slab_alloc_node mm/slub.c:3214 [inline] slab_alloc mm/slub.c:3256 [inline] kmem_cache_alloc_trace+0x25f/0x310 mm/slub.c:3287 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] kernfs_fop_open+0x3c4/0xc70 fs/kernfs/file.c:680 do_dentry_open+0x777/0x1180 fs/open.c:880 do_open fs/namei.c:3557 [inline] path_openat+0x25fc/0x2df0 fs/namei.c:3691 do_filp_open+0x264/0x4f0 fs/namei.c:3718 do_sys_openat2+0x124/0x4e0 fs/open.c:1313 do_sys_open fs/open.c:1329 [inline] __do_sys_openat fs/open.c:1345 [inline] __se_sys_openat fs/open.c:1340 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1340 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1449 [inline] free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1499 free_unref_page_prepare mm/page_alloc.c:3380 [inline] free_unref_page+0x7d/0x5f0 mm/page_alloc.c:3476 free_contig_range+0xa3/0x160 mm/page_alloc.c:9453 destroy_args+0xfe/0x91d mm/debug_vm_pgtable.c:1031 debug_vm_pgtable+0x43e/0x497 mm/debug_vm_pgtable.c:1354 do_one_initcall+0x1c9/0x400 init/main.c:1296 do_initcall_level+0x168/0x218 init/main.c:1369 do_initcalls+0x4b/0x8c init/main.c:1385 kernel_init_freeable+0x3f1/0x57b init/main.c:1623 kernel_init+0x19/0x2b0 init/main.c:1512 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Memory state around the buggy address: ffff8880782e4f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880782e5000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880782e5080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880782e5100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880782e5180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================