loop1: detected capacity change from 0 to 128 VFS: Found a Xenix FS (block size = 1024) on device loop1 ================================================================== BUG: KASAN: use-after-free in sysv_new_block+0x790/0x970 fs/sysv/balloc.c:113 Read of size 4 at addr ffff8880568c80c8 by task syz.1.18/6013 CPU: 1 UID: 0 PID: 6013 Comm: syz.1.18 Not tainted 6.14.0-rc7-syzkaller-00179-gb3ee1e460951 #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:0x7f00e558d169 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:00007f00e6361038 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007f00e57a5fa0 RCX: 00007f00e558d169 RDX: 0000000000000000 RSI: 00002000000000c0 RDI: ffffffffffffff9c RBP: 00007f00e560e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f00e57a5fa0 R15: 00007ffda11f7958 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xa70 pfn:0x568c8 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea00015a3248 ffffea00011e51c8 0000000000000000 raw: 0000000000000a70 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 5978, tgid 5977 (syz.4.10), ts 90724952788, free_ts 91950663851 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 5833 tgid 5833 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: ffff8880568c7f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880568c8000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880568c8080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880568c8100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880568c8180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================