================================================================== BUG: KASAN: slab-use-after-free in evict_inodes+0x136/0x590 Read of size 8 at addr ffff88816ca5cae8 by task syz-executor.0/1973 CPU: 1 PID: 1973 Comm: syz-executor.0 Not tainted 6.9.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x280 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 evict_inodes+0x136/0x590 generic_shutdown_super+0x96/0x260 fs/super.c:626 bch2_kill_sb+0x3c/0x50 fs/bcachefs/fs.c:2012 deactivate_locked_super+0x9f/0x3a0 fs/super.c:472 cleanup_mnt+0x2a6/0x320 fs/namespace.c:1267 task_work_run+0x20f/0x290 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0xb5/0x1c0 kernel/entry/common.c:218 do_syscall_64+0xa4/0x1b0 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x72/0x7a RIP: 0033:0x7fdd8227f097 Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8 RSP: 002b:00007ffdf24f8448 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007fdd8227f097 RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00007ffdf24f8500 RBP: 00007ffdf24f8500 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffdf24f95c0 R13: 00007fdd822c9336 R14: 000000000000f579 R15: 0000000000000003 Allocated by task 2647: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:338 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] kmem_cache_alloc+0x15f/0x390 mm/slub.c:3852 bch2_alloc_inode+0x1a/0x110 fs/bcachefs/fs.c:1494 alloc_inode fs/inode.c:261 [inline] new_inode_pseudo+0x5b/0x190 fs/inode.c:1007 new_inode+0x17/0x1b0 fs/inode.c:1033 bch2_new_inode+0x9f/0x180 fs/bcachefs/fs.c:224 bch2_lookup_trans fs/bcachefs/fs.c:408 [inline] bch2_lookup+0xad0/0x10c0 fs/bcachefs/fs.c:437 lookup_open fs/namei.c:3475 [inline] open_last_lookups fs/namei.c:3566 [inline] path_openat+0xd15/0x27f0 fs/namei.c:3796 do_filp_open+0x22b/0x440 fs/namei.c:3826 do_sys_openat2+0xf6/0x180 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x20d/0x260 fs/open.c:1432 do_syscall_64+0x95/0x1b0 entry_SYSCALL_64_after_hwframe+0x72/0x7a Freed by task 2647: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xee/0x1a0 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kmem_cache_free+0x136/0x330 mm/slub.c:4344 bch2_inode_insert+0x328/0x380 fs/bcachefs/fs.c:192 bch2_lookup_trans fs/bcachefs/fs.c:420 [inline] bch2_lookup+0xb56/0x10c0 fs/bcachefs/fs.c:437 lookup_open fs/namei.c:3475 [inline] open_last_lookups fs/namei.c:3566 [inline] path_openat+0xd15/0x27f0 fs/namei.c:3796 do_filp_open+0x22b/0x440 fs/namei.c:3826 do_sys_openat2+0xf6/0x180 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x20d/0x260 fs/open.c:1432 do_syscall_64+0x95/0x1b0 entry_SYSCALL_64_after_hwframe+0x72/0x7a The buggy address belongs to the object at ffff88816ca5c920 which belongs to the cache bch_inode_info of size 1744 The buggy address is located 456 bytes inside of freed 1744-byte region [ffff88816ca5c920, ffff88816ca5cff0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16ca58 head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x100000000000840(slab|head|node=0|zone=2) page_type: 0xffffffff() raw: 0100000000000840 ffff88810c6ba780 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080110011 00000001ffffffff 0000000000000000 head: 0100000000000840 ffff88810c6ba780 dead000000000122 0000000000000000 head: 0000000000000000 0000000080110011 00000001ffffffff 0000000000000000 head: 0100000000000003 ffffea0005b29601 dead000000000122 00000000ffffffff head: 0000000800000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x1d2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 2583, tgid 2582 (syz-executor.0), ts 60512985357, free_ts 30311191201 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x10f/0x130 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0x3e5f/0x4080 mm/page_alloc.c:3317 __alloc_pages+0x256/0x670 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2175 allocate_slab mm/slub.c:2338 [inline] new_slab+0x70/0x270 mm/slub.c:2391 ___slab_alloc+0xb0d/0x1040 mm/slub.c:3525 __slab_alloc mm/slub.c:3610 [inline] __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] kmem_cache_alloc+0x23a/0x390 mm/slub.c:3852 bch2_alloc_inode+0x1a/0x110 fs/bcachefs/fs.c:1494 alloc_inode fs/inode.c:261 [inline] new_inode_pseudo+0x5b/0x190 fs/inode.c:1007 new_inode+0x17/0x1b0 fs/inode.c:1033 bch2_new_inode+0x9f/0x180 fs/bcachefs/fs.c:224 bch2_lookup_trans fs/bcachefs/fs.c:408 [inline] bch2_lookup+0xad0/0x10c0 fs/bcachefs/fs.c:437 lookup_open fs/namei.c:3475 [inline] open_last_lookups fs/namei.c:3566 [inline] path_openat+0xd15/0x27f0 fs/namei.c:3796 do_filp_open+0x22b/0x440 fs/namei.c:3826 do_sys_openat2+0xf6/0x180 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x20d/0x260 fs/open.c:1432 page last free pid 1447 tgid 1444 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x87f/0x9a0 mm/page_alloc.c:2347 free_unref_folios+0x17e/0x9e0 mm/page_alloc.c:2536 folios_put_refs+0x5e2/0x6d0 mm/swap.c:1034 free_pages_and_swap_cache+0x27a/0x4e0 mm/swap_state.c:329 __tlb_batch_free_encoded_pages mm/mmu_gather.c:136 [inline] tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu+0x2ad/0x4e0 mm/mmu_gather.c:373 zap_pte_range mm/memory.c:1683 [inline] zap_pmd_range mm/memory.c:1722 [inline] zap_pud_range mm/memory.c:1751 [inline] zap_p4d_range mm/memory.c:1772 [inline] unmap_page_range+0x305a/0x3790 mm/memory.c:1793 unmap_vmas+0x1ee/0x2a0 mm/memory.c:1883 exit_mmap+0x257/0xa10 mm/mmap.c:3267 __mmput+0x9b/0x2d0 kernel/fork.c:1345 exit_mm+0x114/0x1b0 kernel/exit.c:569 do_exit+0x7cd/0x2490 kernel/exit.c:865 do_group_exit+0x1ba/0x280 kernel/exit.c:1027 get_signal+0x109f/0x11b0 kernel/signal.c:2911 arch_do_signal_or_restart+0x91/0x670 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x57/0x1c0 kernel/entry/common.c:218 do_syscall_64+0xa4/0x1b0 arch/x86/entry/common.c:89 Memory state around the buggy address: ffff88816ca5c980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88816ca5ca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88816ca5ca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88816ca5cb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88816ca5cb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================