sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size sysv_free_block: flc_count > flc_size ================================================================== BUG: KASAN: use-after-free in sysv_new_block+0x819/0x990 fs/sysv/balloc.c:113 Read of size 4 at addr ffff88807205c0c8 by task syz-executor746/5071 CPU: 1 PID: 5071 Comm: syz-executor746 Not tainted 6.1.0-syzkaller-14127-gec34c2b4ec38 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x45d mm/kasan/report.c:417 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517 sysv_new_block+0x819/0x990 fs/sysv/balloc.c:113 alloc_branch fs/sysv/itree.c:134 [inline] get_block+0x26b/0x1580 fs/sysv/itree.c:251 __block_write_begin_int+0x3bd/0x14b0 fs/buffer.c:1991 __block_write_begin fs/buffer.c:2041 [inline] block_write_begin+0xb9/0x4d0 fs/buffer.c:2102 sysv_write_begin+0x31/0xd0 fs/sysv/itree.c:485 generic_perform_write+0x256/0x570 mm/filemap.c:3772 __generic_file_write_iter+0x2ae/0x500 mm/filemap.c:3900 generic_file_write_iter+0xe3/0x350 mm/filemap.c:3932 call_write_iter include/linux/fs.h:2186 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9ed/0xdd0 fs/read_write.c:584 ksys_write+0x12b/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f0bacd960b9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 15 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffc493d7ea8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f0bacd960b9 RDX: 00000000fffffd5e RSI: 000000002000ad00 RDI: 0000000000000004 RBP: 0000000000000003 R08: 0000000000000020 R09: 0000000000000020 R10: 0000000000009e07 R11: 0000000000000246 R12: 00007ffc493d7f20 R13: 00007ffc493d7ef8 R14: 00007ffc493d7f40 R15: 0000000000000000 The buggy address belongs to the physical page: page:ffffea0001c81700 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7205c flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0001c81748 ffffea0001c816c8 0000000000000000 raw: 0000000000000001 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 0x140dca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_ZERO), pid 5061, tgid 5061 (sshd), ts 47911150658, free_ts 47923845373 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549 __folio_alloc+0x16/0x40 mm/page_alloc.c:5581 vma_alloc_folio+0x155/0x870 mm/mempolicy.c:2246 alloc_page_vma include/linux/gfp.h:284 [inline] do_anonymous_page mm/memory.c:4074 [inline] handle_pte_fault mm/memory.c:4929 [inline] __handle_mm_fault+0x1822/0x3c90 mm/memory.c:5073 handle_mm_fault+0x1b6/0x850 mm/memory.c:5219 do_user_addr_fault+0x475/0x1210 arch/x86/mm/fault.c:1428 handle_page_fault arch/x86/mm/fault.c:1519 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1575 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page_list+0x176/0xcd0 mm/page_alloc.c:3510 release_pages+0xcb1/0x1330 mm/swap.c:1076 tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:97 tlb_flush_mmu_free mm/mmu_gather.c:292 [inline] tlb_flush_mmu mm/mmu_gather.c:299 [inline] tlb_finish_mmu+0x14b/0x7e0 mm/mmu_gather.c:391 unmap_region+0x22c/0x2b0 mm/mmap.c:2187 do_mas_align_munmap+0xc44/0x1260 mm/mmap.c:2440 do_mas_munmap+0x26e/0x2c0 mm/mmap.c:2498 __vm_munmap+0x14f/0x290 mm/mmap.c:2775 __do_sys_munmap mm/mmap.c:2800 [inline] __se_sys_munmap mm/mmap.c:2797 [inline] __x64_sys_munmap+0x59/0x80 mm/mmap.c:2797 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88807205bf80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88807205c000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88807205c080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88807205c100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88807205c180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================