loop0: detected capacity change from 0 to 32768 ialloc: diAlloc returned -5! syz.0.0: attempt to access beyond end of device loop0: rw=8388609, sector=4680032, nr_sectors = 8 limit=32768 metapage_write_end_io: I/O error ERROR: (device loop0): release_metapage: metapage_write_one() failed ERROR: (device loop0): remounting filesystem as read-only ================================================================== BUG: KASAN: slab-use-after-free in drop_metapage fs/jfs/jfs_metapage.c:311 [inline] BUG: KASAN: slab-use-after-free in release_metapage+0x760/0xac0 fs/jfs/jfs_metapage.c:892 Read of size 8 at addr ffff888041d82db8 by task syz.0.0/5339 CPU: 0 UID: 0 PID: 5339 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xba/0x230 mm/kasan/report.c:482 kasan_report+0x117/0x150 mm/kasan/report.c:595 drop_metapage fs/jfs/jfs_metapage.c:311 [inline] release_metapage+0x760/0xac0 fs/jfs/jfs_metapage.c:892 diNewIAG fs/jfs/jfs_imap.c:2584 [inline] diAllocExt fs/jfs/jfs_imap.c:1905 [inline] diAllocAG+0x1740/0x1db0 fs/jfs/jfs_imap.c:1669 diAlloc+0x1d5/0x1680 fs/jfs/jfs_imap.c:1590 ialloc+0x8c/0x8f0 fs/jfs/jfs_inode.c:56 jfs_mkdir+0x1e1/0xb00 fs/jfs/namei.c:225 vfs_mkdir+0x511/0x5b0 fs/namei.c:5139 do_mkdirat+0x27d/0x4b0 fs/namei.c:5173 __do_sys_mkdirat fs/namei.c:5195 [inline] __se_sys_mkdirat fs/namei.c:5193 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:5193 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f1d99d99b97 Code: 00 66 90 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 db f7 ff ff 66 2e 0f 1f 84 00 00 00 00 00 90 b8 02 01 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f1d9ac8ee58 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007f1d9ac8eee0 RCX: 00007f1d99d99b97 RDX: 00000000000001ff RSI: 0000200000000280 RDI: 00000000ffffff9c RBP: 0000200000000300 R08: 00002000000000c0 R09: 0000000000000000 R10: 0000200000000300 R11: 0000000000000246 R12: 0000200000000280 R13: 00007f1d9ac8eea0 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 5339: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 unpoison_slab_object mm/kasan/common.c:340 [inline] __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:366 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4953 [inline] slab_alloc_node mm/slub.c:5263 [inline] kmem_cache_alloc_noprof+0x370/0x6e0 mm/slub.c:5270 mempool_alloc_noprof+0x1ce/0x300 mm/mempool.c:567 alloc_metapage fs/jfs/jfs_metapage.c:264 [inline] __get_metapage+0x50c/0xde0 fs/jfs/jfs_metapage.c:760 diNewIAG fs/jfs/jfs_imap.c:2545 [inline] diAllocExt fs/jfs/jfs_imap.c:1905 [inline] diAllocAG+0x165d/0x1db0 fs/jfs/jfs_imap.c:1669 diAlloc+0x1d5/0x1680 fs/jfs/jfs_imap.c:1590 ialloc+0x8c/0x8f0 fs/jfs/jfs_inode.c:56 jfs_mkdir+0x1e1/0xb00 fs/jfs/namei.c:225 vfs_mkdir+0x511/0x5b0 fs/namei.c:5139 do_mkdirat+0x27d/0x4b0 fs/namei.c:5173 __do_sys_mkdirat fs/namei.c:5195 [inline] __se_sys_mkdirat fs/namei.c:5193 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:5193 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xe2/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 77: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2540 [inline] slab_free mm/slub.c:6674 [inline] kmem_cache_free+0x195/0x610 mm/slub.c:6785 mempool_free+0xec/0x130 mm/mempool.c:712 free_metapage fs/jfs/jfs_metapage.c:279 [inline] metapage_release_folio+0x40e/0x540 fs/jfs/jfs_metapage.c:636 shrink_folio_list+0x2164/0x5160 mm/vmscan.c:1484 evict_folios+0x4795/0x5880 mm/vmscan.c:4711 try_to_shrink_lruvec+0x88b/0xb20 mm/vmscan.c:4874 shrink_one+0x25c/0x710 mm/vmscan.c:4919 shrink_many mm/vmscan.c:4982 [inline] lru_gen_shrink_node mm/vmscan.c:5060 [inline] shrink_node+0x2f8b/0x35f0 mm/vmscan.c:6047 kswapd_shrink_node mm/vmscan.c:6901 [inline] balance_pgdat mm/vmscan.c:7084 [inline] kswapd+0x144c/0x2800 mm/vmscan.c:7354 kthread+0x726/0x8b0 kernel/kthread.c:463 ret_from_fork+0x51b/0xa40 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 The buggy address belongs to the object at ffff888041d82d90 which belongs to the cache jfs_mp of size 184 The buggy address is located 40 bytes inside of freed 184-byte region [ffff888041d82d90, ffff888041d82e48) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x41d82 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000000 ffff888031756000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080100010 00000000f5000000 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 0xd2800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5339, tgid 5338 (syz.0.0), ts 75704043453, free_ts 75699036105 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x228/0x280 mm/page_alloc.c:1884 prep_new_page mm/page_alloc.c:1892 [inline] get_page_from_freelist+0x24dc/0x2580 mm/page_alloc.c:3945 __alloc_frozen_pages_noprof+0x18d/0x380 mm/page_alloc.c:5240 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2486 alloc_slab_page mm/slub.c:3075 [inline] allocate_slab+0x86/0x3a0 mm/slub.c:3248 new_slab mm/slub.c:3302 [inline] ___slab_alloc+0xd82/0x1760 mm/slub.c:4656 __slab_alloc+0x65/0x100 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] kmem_cache_alloc_noprof+0x3fe/0x6e0 mm/slub.c:5270 mempool_alloc_noprof+0x1ce/0x300 mm/mempool.c:567 alloc_metapage fs/jfs/jfs_metapage.c:264 [inline] __get_metapage+0x50c/0xde0 fs/jfs/jfs_metapage.c:760 diReadSpecial+0x25b/0x710 fs/jfs/jfs_imap.c:447 jfs_mount+0x73/0x870 fs/jfs/jfs_mount.c:87 jfs_fill_super+0x6bc/0xd80 fs/jfs/super.c:523 get_tree_bdev_flags+0x431/0x4f0 fs/super.c:1691 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x329/0xa50 fs/namespace.c:3712 page last free pid 4735 tgid 4735 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1433 [inline] __free_frozen_pages+0xbb0/0xd10 mm/page_alloc.c:2973 __tlb_remove_table_free mm/mmu_gather.c:228 [inline] tlb_remove_table_rcu+0x85/0x100 mm/mmu_gather.c:291 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0xc9e/0x1750 kernel/rcu/tree.c:2857 handle_softirqs+0x22a/0x7c0 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x5f/0x150 kernel/softirq.c:723 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1056 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1056 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 Memory state around the buggy address: ffff888041d82c80: fc fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888041d82d00: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc >ffff888041d82d80: fc fc fa fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888041d82e00: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc ffff888041d82e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================