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+0x7bb/0xa70 fs/sysv/balloc.c:113 Read of size 4 at addr ffff888030eb20c8 by task syz-executor805/5165 CPU: 2 PID: 5165 Comm: syz-executor805 Not tainted 6.8.0-rc7-syzkaller-00250-g137e0ec05aeb #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc4/0x620 mm/kasan/report.c:488 kasan_report+0xda/0x110 mm/kasan/report.c:601 sysv_new_block+0x7bb/0xa70 fs/sysv/balloc.c:113 alloc_branch fs/sysv/itree.c:135 [inline] get_block+0x279/0x15c0 fs/sysv/itree.c:256 __block_write_begin_int+0x4fb/0x16e0 fs/buffer.c:2103 __block_write_begin fs/buffer.c:2152 [inline] block_write_begin+0xb1/0x4a0 fs/buffer.c:2211 sysv_write_begin+0x31/0xe0 fs/sysv/itree.c:492 generic_perform_write+0x273/0x620 mm/filemap.c:3930 __generic_file_write_iter+0x1fd/0x240 mm/filemap.c:4025 generic_file_write_iter+0xe7/0x350 mm/filemap.c:4051 call_write_iter include/linux/fs.h:2087 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6de/0x1110 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7fdbf9b09359 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 1c 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:00007fffff2150d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fdbf9b09359 RDX: 00000000fffffd5e RSI: 000000002000ad00 RDI: 0000000000000004 RBP: 00007fdbf9b8a720 R08: 00007fdbf9b4d53f R09: 00007fdbf9b4d53f R10: 0000000000009e07 R11: 0000000000000246 R12: 00007fdbf9b4d004 R13: 00007fffff2151a8 R14: 00007fffff2151b0 R15: 00007fffff2151d0 The buggy address belongs to the physical page: page:ffffea0000c3ac80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x30eb2 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000000 ffffea0000c3acc8 ffffea0000be3848 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 5152, tgid 5152 (sshd), ts 43826954839, free_ts 43852381197 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3311 __alloc_pages+0x22c/0x2430 mm/page_alloc.c:4569 alloc_pages_mpol+0x258/0x600 mm/mempolicy.c:2133 vma_alloc_folio+0xad/0x220 mm/mempolicy.c:2172 alloc_anon_folio mm/memory.c:4234 [inline] do_anonymous_page mm/memory.c:4292 [inline] do_pte_missing mm/memory.c:3743 [inline] handle_pte_fault mm/memory.c:5164 [inline] __handle_mm_fault+0x25ca/0x4920 mm/memory.c:5305 handle_mm_fault+0x47a/0xa10 mm/memory.c:5470 do_user_addr_fault+0x30b/0x1030 arch/x86/mm/fault.c:1355 handle_page_fault arch/x86/mm/fault.c:1498 [inline] exc_page_fault+0x5d/0xc0 arch/x86/mm/fault.c:1554 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 page last free pid 5152 tgid 5152 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2346 free_unref_page_list+0xe6/0xb40 mm/page_alloc.c:2532 release_pages+0x32a/0x14f0 mm/swap.c:1042 tlb_batch_pages_flush+0x9a/0x190 mm/mmu_gather.c:98 tlb_flush_mmu_free mm/mmu_gather.c:293 [inline] tlb_flush_mmu mm/mmu_gather.c:300 [inline] tlb_finish_mmu+0x14b/0x700 mm/mmu_gather.c:392 unmap_region+0x342/0x420 mm/mmap.c:2319 do_vmi_align_munmap+0x11b3/0x1ad0 mm/mmap.c:2635 do_vmi_munmap+0x20e/0x450 mm/mmap.c:2703 __vm_munmap+0x146/0x3a0 mm/mmap.c:2990 __do_sys_munmap mm/mmap.c:3007 [inline] __se_sys_munmap mm/mmap.c:3004 [inline] __x64_sys_munmap+0x62/0x90 mm/mmap.c:3004 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6f/0x77 Memory state around the buggy address: ffff888030eb1f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888030eb2000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888030eb2080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888030eb2100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888030eb2180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================