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 ffff8880402fa0c8 by task syz-executor.0/5473 CPU: 3 PID: 5473 Comm: syz-executor.0 Not tainted 6.10.0-rc4-syzkaller-00148-g50736169ecc8 #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/0x1570 fs/sysv/itree.c:254 __block_write_begin_int+0x4fb/0x16e0 fs/buffer.c:2128 __block_write_begin fs/buffer.c:2177 [inline] block_write_begin+0xb1/0x4a0 fs/buffer.c:2236 sysv_write_begin+0x31/0xe0 fs/sysv/itree.c:490 generic_perform_write+0x272/0x620 mm/filemap.c:4015 __generic_file_write_iter+0x1fd/0x240 mm/filemap.c:4110 generic_file_write_iter+0xe7/0x350 mm/filemap.c:4136 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b6/0x1140 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+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fcd9767dda9 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:00007fcd983f10c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fcd977abf80 RCX: 00007fcd9767dda9 RDX: 00000000fffffd5e RSI: 000000002000ad00 RDI: 0000000000000004 RBP: 00007fcd976ca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fcd977abf80 R15: 00007fffa85f1ab8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x1a1 pfn:0x402fa flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0000cab408 ffff88806b344bf0 0000000000000000 raw: 00000000000001a1 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 5467, tgid 5467 (dhcpcd-run-hook), ts 77465129141, free_ts 77581288849 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1468 prep_new_page mm/page_alloc.c:1476 [inline] get_page_from_freelist+0x136a/0x2e50 mm/page_alloc.c:3420 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4678 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2265 vma_alloc_folio_noprof+0xad/0x1f0 mm/mempolicy.c:2304 folio_prealloc mm/memory.c:1050 [inline] wp_page_copy mm/memory.c:3285 [inline] do_wp_page+0x1acd/0x3340 mm/memory.c:3677 handle_pte_fault mm/memory.c:5396 [inline] __handle_mm_fault+0x2311/0x5410 mm/memory.c:5523 handle_mm_fault+0x476/0xa00 mm/memory.c:5688 do_user_addr_fault+0x426/0xe50 arch/x86/mm/fault.c:1338 handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 page last free pid 5467 tgid 5467 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1088 [inline] free_unref_folios+0x991/0x1310 mm/page_alloc.c:2632 folios_put_refs+0x487/0x6d0 mm/swap.c:1024 free_pages_and_swap_cache+0x36d/0x510 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+0x3d1/0xb20 mm/mmap.c:3354 __mmput+0x12a/0x4d0 kernel/fork.c:1346 mmput+0x62/0x70 kernel/fork.c:1368 exit_mm kernel/exit.c:565 [inline] do_exit+0x9b7/0x2ba0 kernel/exit.c:861 do_group_exit+0xd3/0x2a0 kernel/exit.c:1023 __do_sys_exit_group kernel/exit.c:1034 [inline] __se_sys_exit_group kernel/exit.c:1032 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1032 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880402f9f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880402fa000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880402fa080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880402fa100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880402fa180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================