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+0x7a7/0xa50 fs/sysv/balloc.c:113 Read of size 4 at addr ffff88803ef970c8 by task syz-executor.0/5481 CPU: 2 PID: 5481 Comm: syz-executor.0 Not tainted 6.9.0-rc1-syzkaller-g4cece7649650 #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+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 sysv_new_block+0x7a7/0xa50 fs/sysv/balloc.c:113 alloc_branch fs/sysv/itree.c:135 [inline] get_block+0x261/0x15a0 fs/sysv/itree.c:254 __block_write_begin_int+0x4fb/0x16e0 fs/buffer.c:2105 __block_write_begin fs/buffer.c:2154 [inline] block_write_begin+0xb1/0x4a0 fs/buffer.c:2213 sysv_write_begin+0x31/0xe0 fs/sysv/itree.c:490 generic_perform_write+0x272/0x620 mm/filemap.c:3974 __generic_file_write_iter+0x1fd/0x240 mm/filemap.c:4069 generic_file_write_iter+0xe7/0x350 mm/filemap.c:4095 call_write_iter include/linux/fs.h:2108 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6db/0x1100 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+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 RIP: 0033:0x7f05cc87dda9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f05cd5b50c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f05cc9abf80 RCX: 00007f05cc87dda9 RDX: 00000000fffffe45 RSI: 00000000200000c0 RDI: 0000000000000004 RBP: 00007f05cc8ca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f05cc9abf80 R15: 00007ffde71a97d8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x3ef97 flags: 0xfff80000000000(node=0|zone=1|lastcpupid=0xfff) page_type: 0xffffffff() raw: 00fff80000000000 dead000000000100 dead000000000122 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 9, migratetype Movable, gfp_mask 0x3d24ca(GFP_TRANSHUGE|__GFP_NORETRY|__GFP_THISNODE), pid 5190, tgid 5190 (syz-fuzzer), ts 63658266884, free_ts 66393138789 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_mpol+0x22e/0x610 mm/mempolicy.c:2251 vma_alloc_folio+0xad/0x160 mm/mempolicy.c:2303 do_huge_pmd_anonymous_page+0x243/0x2180 mm/huge_memory.c:1049 create_huge_pmd mm/memory.c:5173 [inline] __handle_mm_fault+0x21fb/0x4b40 mm/memory.c:5410 handle_mm_fault+0x476/0xa00 mm/memory.c:5604 do_user_addr_fault+0x426/0x1080 arch/x86/mm/fault.c:1362 handle_page_fault arch/x86/mm/fault.c:1505 [inline] exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 page last free pid 5198 tgid 5190 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347 free_unref_folios+0xf4/0xad0 mm/page_alloc.c:2536 folios_put_refs+0x49c/0x750 mm/swap.c:1034 free_pages_and_swap_cache+0x25b/0x4b0 mm/swap_state.c:329 __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu mm/mmu_gather.c:373 [inline] tlb_finish_mmu+0x168/0x7b0 mm/mmu_gather.c:465 exit_mmap+0x3da/0xb90 mm/mmap.c:3280 __mmput+0x12a/0x4d0 kernel/fork.c:1345 mmput+0x62/0x70 kernel/fork.c:1367 exit_mm kernel/exit.c:569 [inline] do_exit+0x999/0x2c10 kernel/exit.c:865 do_group_exit+0xd3/0x2a0 kernel/exit.c:1027 __do_sys_exit_group kernel/exit.c:1038 [inline] __se_sys_exit_group kernel/exit.c:1036 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1036 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 Memory state around the buggy address: ffff88803ef96f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803ef97000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88803ef97080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88803ef97100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803ef97180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================