loop2: detected capacity change from 0 to 32768 ================================================================== BUG: KASAN: use-after-free in jfs_readdir+0x1313/0x4410 fs/jfs/jfs_dtree.c:3160 Read of size 8 at addr ffff8881713ef6f8 by task syz.2.17/4433 CPU: 0 PID: 4433 Comm: syz.2.17 Not tainted 5.16.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x210/0x2fc lib/dump_stack.c:106 print_address_description+0x62/0x350 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report+0x16b/0x1c0 mm/kasan/report.c:450 jfs_readdir+0x1313/0x4410 fs/jfs/jfs_dtree.c:3160 iterate_dir+0x229/0x570 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1eb/0x4b0 fs/readdir.c:271 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f5278591d29 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f527800b038 EFLAGS: 00000246 ORIG_RAX: 000000000000004e RAX: ffffffffffffffda RBX: 00007f5278781fa0 RCX: 00007f5278591d29 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004 RBP: 00007f527860db08 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f5278781fa0 R15: 00007fff555eff28 Allocated by task 4433: 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+0xb1/0xf0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook+0x54/0x2f0 mm/slab.h:519 slab_alloc_node mm/slub.c:3234 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x107/0x2a0 mm/slub.c:3247 mempool_alloc+0x14f/0x560 mm/mempool.c:392 alloc_metapage fs/jfs/jfs_metapage.c:176 [inline] __get_metapage+0x638/0xfa0 fs/jfs/jfs_metapage.c:653 dtSplitRoot+0x23c/0x16c0 fs/jfs/jfs_dtree.c:1902 dtSplitUp fs/jfs/jfs_dtree.c:985 [inline] dtInsert+0x1254/0x6720 fs/jfs/jfs_dtree.c:863 jfs_mkdir+0x7f3/0xbb0 fs/jfs/namei.c:270 vfs_mkdir+0x216/0x3d0 fs/namei.c:3883 do_mkdirat+0x249/0x4c0 fs/namei.c:3909 __do_sys_mkdirat fs/namei.c:3924 [inline] __se_sys_mkdirat fs/namei.c:3922 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:3922 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 4433: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x102/0x140 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x12c/0x1a0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kmem_cache_free+0xc8/0x1f0 mm/slub.c:3530 free_metapage fs/jfs/jfs_metapage.c:191 [inline] drop_metapage fs/jfs/jfs_metapage.c:228 [inline] release_metapage+0x9f9/0xec0 fs/jfs/jfs_metapage.c:759 dtReadNext fs/jfs/jfs_dtree.c:3465 [inline] jfs_readdir+0x1041/0x4410 fs/jfs/jfs_dtree.c:3153 iterate_dir+0x229/0x570 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1eb/0x4b0 fs/readdir.c:271 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff8881713ef6c8 which belongs to the cache jfs_mp of size 184 The buggy address is located 48 bytes inside of 184-byte region [ffff8881713ef6c8, ffff8881713ef780) The buggy address belongs to the page: page:ffffea0005c4fbc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1713ef flags: 0x100000000000200(slab|node=0|zone=2) raw: 0100000000000200 0000000000000000 dead000000000122 ffff88810ab5c8c0 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x192800(GFP_NOWAIT|__GFP_NOWARN|__GFP_NORETRY|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4433, ts 83594360413, free_ts 83516176480 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0x3a61/0x3c60 mm/page_alloc.c:4149 __alloc_pages+0x277/0x700 mm/page_alloc.c:5369 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x9c/0x440 mm/slub.c:1993 ___slab_alloc+0x5c1/0xac0 mm/slub.c:3022 __slab_alloc mm/slub.c:3109 [inline] slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x19e/0x2a0 mm/slub.c:3247 mempool_alloc+0x14f/0x560 mm/mempool.c:392 alloc_metapage fs/jfs/jfs_metapage.c:176 [inline] __get_metapage+0x638/0xfa0 fs/jfs/jfs_metapage.c:653 diIAGRead fs/jfs/jfs_imap.c:2662 [inline] diAllocExt fs/jfs/jfs_imap.c:1911 [inline] diAllocAG+0x325/0x1a80 fs/jfs/jfs_imap.c:1662 diAlloc+0x326/0x1630 fs/jfs/jfs_imap.c:1583 ialloc+0x8b/0x970 fs/jfs/jfs_inode.c:56 jfs_mkdir+0x1c1/0xbb0 fs/jfs/namei.c:225 vfs_mkdir+0x216/0x3d0 fs/namei.c:3883 do_mkdirat+0x249/0x4c0 fs/namei.c:3909 __do_sys_mkdirat fs/namei.c:3924 [inline] __se_sys_mkdirat fs/namei.c:3922 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:3922 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare mm/page_alloc.c:1389 [inline] free_unref_page_prepare+0xb4c/0xc00 mm/page_alloc.c:3309 free_unref_page_list+0x1e0/0x850 mm/page_alloc.c:3425 release_pages+0x16b7/0x1910 mm/swap.c:980 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:242 [inline] tlb_flush_mmu mm/mmu_gather.c:249 [inline] tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:340 exit_mmap+0x3cd/0x650 mm/mmap.c:3172 __mmput+0x112/0x3b0 kernel/fork.c:1113 exit_mm+0x13a/0x200 kernel/exit.c:507 do_exit+0xacb/0x2930 kernel/exit.c:819 do_group_exit+0x144/0x310 kernel/exit.c:929 __do_sys_exit_group kernel/exit.c:940 [inline] __se_sys_exit_group kernel/exit.c:938 [inline] __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:938 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff8881713ef580: 00 00 fc fc fc fc fc fc fc fc fa fb fb fb fb fb ffff8881713ef600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881713ef680: fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb ^ ffff8881713ef700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881713ef780: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 ==================================================================