loop5: detected capacity change from 0 to 128 VFS: Found a Xenix FS (block size = 1024) on device loop5 ================================================================== BUG: KASAN: use-after-free in sysv_new_block+0x790/0x970 fs/sysv/balloc.c:113 Read of size 4 at addr ffff888049ab50c8 by task syz.5.206/8283 CPU: 0 UID: 0 PID: 8283 Comm: syz.5.206 Not tainted 6.14.0-rc7-syzkaller-00205-g586de92313fc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0x16e/0x5b0 mm/kasan/report.c:521 kasan_report+0x143/0x180 mm/kasan/report.c:634 sysv_new_block+0x790/0x970 fs/sysv/balloc.c:113 alloc_branch fs/sysv/itree.c:135 [inline] get_block+0x30a/0x16e0 fs/sysv/itree.c:254 __block_write_begin_int+0x692/0x19a0 fs/buffer.c:2116 sysv_make_empty+0xa8/0x640 fs/sysv/dir.c:262 sysv_mkdir+0x7f/0x130 fs/sysv/namei.c:130 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4313 do_mkdirat+0x264/0x3a0 fs/namei.c:4336 __do_sys_mkdirat fs/namei.c:4351 [inline] __se_sys_mkdirat fs/namei.c:4349 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4349 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f02b0b8d169 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:00007f02b192c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007f02b0da5fa0 RCX: 00007f02b0b8d169 RDX: 0000000000000000 RSI: 0000200000000100 RDI: ffffffffffffff9c RBP: 00007f02b0c0e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f02b0da5fa0 R15: 00007ffdae76dfe8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x51c pfn:0x49ab5 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea000126ad08 ffffea000126ad88 0000000000000000 raw: 000000000000051c 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 8145, tgid 8144 (syz.2.194), ts 182426052791, free_ts 188082518752 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x292/0x710 mm/page_alloc.c:4740 alloc_pages_mpol+0x311/0x660 mm/mempolicy.c:2270 folio_alloc_mpol_noprof+0x36/0x70 mm/mempolicy.c:2289 shmem_alloc_folio mm/shmem.c:1863 [inline] shmem_alloc_and_add_folio+0x4a0/0x1090 mm/shmem.c:1902 shmem_get_folio_gfp+0x621/0x1840 mm/shmem.c:2545 shmem_get_folio mm/shmem.c:2651 [inline] shmem_write_begin+0x165/0x350 mm/shmem.c:3301 generic_perform_write+0x327/0xa00 mm/filemap.c:4102 shmem_file_write_iter+0xf9/0x120 mm/shmem.c:3477 new_sync_write fs/read_write.c:586 [inline] vfs_write+0xacf/0xd10 fs/read_write.c:679 ksys_write+0x18f/0x2b0 fs/read_write.c:731 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5823 tgid 5823 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_folios+0xe2f/0x18a0 mm/page_alloc.c:2707 folios_put_refs+0x76c/0x860 mm/swap.c:994 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x593/0x1820 mm/shmem.c:1112 shmem_truncate_range mm/shmem.c:1224 [inline] shmem_evict_inode+0x29b/0xa80 mm/shmem.c:1352 evict+0x4e8/0x9a0 fs/inode.c:796 __dentry_kill+0x20d/0x630 fs/dcache.c:643 dput+0x19f/0x2b0 fs/dcache.c:885 __fput+0x60b/0x9f0 fs/file_table.c:472 task_work_run+0x24f/0x310 kernel/task_work.c:227 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:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x13f/0x340 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888049ab4f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888049ab5000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888049ab5080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888049ab5100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888049ab5180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================