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 ffff88803f28a0c8 by task syz-executor.0/5542 CPU: 1 UID: 0 PID: 5542 Comm: syz-executor.0 Not tainted 6.11.0-rc5-syzkaller-g20371ba12063 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 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:2125 __block_write_begin fs/buffer.c:2174 [inline] block_write_begin+0xb1/0x4a0 fs/buffer.c:2235 sysv_write_begin+0x31/0xe0 fs/sysv/itree.c:490 generic_perform_write+0x312/0xaa0 mm/filemap.c:4019 __generic_file_write_iter+0x1fd/0x240 mm/filemap.c:4121 generic_file_write_iter+0xe7/0x350 mm/filemap.c:4147 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:0x7f1025c7dda9 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:00007f10269280c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f1025dabf80 RCX: 00007f1025c7dda9 RDX: 00000000fffffe45 RSI: 00000000200000c0 RDI: 0000000000000004 RBP: 00007f1025cca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f1025dabf80 R15: 00007ffc9e676e38 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x5850 pfn:0x3f28a flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000005850 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 0x152c4a(GFP_NOFS|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 5358, tgid 5358 (syz-executor), ts 71736410869, free_ts 91515350253 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1493 prep_new_page mm/page_alloc.c:1501 [inline] get_page_from_freelist+0x1351/0x2e50 mm/page_alloc.c:3439 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4695 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2263 folio_alloc_noprof+0x1e/0xc0 mm/mempolicy.c:2350 filemap_alloc_folio_noprof+0x3ba/0x490 mm/filemap.c:1008 page_cache_ra_unbounded+0x1c8/0x5a0 mm/readahead.c:248 do_page_cache_ra mm/readahead.c:303 [inline] page_cache_ra_order+0x6b5/0xb80 mm/readahead.c:488 page_cache_async_ra+0x5cb/0x820 mm/readahead.c:638 filemap_readahead mm/filemap.c:2504 [inline] filemap_get_pages+0x357/0x1830 mm/filemap.c:2545 filemap_read+0x3af/0xd10 mm/filemap.c:2625 generic_file_read_iter+0x350/0x460 mm/filemap.c:2806 ext4_file_read_iter+0x1dc/0x6c0 fs/ext4/file.c:147 __kernel_read+0x3ec/0xb50 fs/read_write.c:434 integrity_kernel_read+0x7f/0xb0 security/integrity/iint.c:28 ima_calc_file_hash_tfm+0x2cf/0x3e0 security/integrity/ima/ima_crypto.c:480 page last free pid 5473 tgid 5473 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_folios+0x9e9/0x1390 mm/page_alloc.c:2660 folios_put_refs+0x560/0x760 mm/swap.c:1039 folio_batch_release include/linux/pagevec.h:101 [inline] truncate_inode_pages_range+0x334/0xe80 mm/truncate.c:346 ext4_evict_inode+0x2cc/0x17d0 fs/ext4/inode.c:193 evict+0x398/0x8c0 fs/inode.c:704 iput_final fs/inode.c:1838 [inline] iput.part.0+0x5a8/0x7f0 fs/inode.c:1864 iput+0x5c/0x80 fs/inode.c:1854 do_unlinkat+0x613/0x750 fs/namei.c:4493 __do_sys_unlink fs/namei.c:4534 [inline] __se_sys_unlink fs/namei.c:4532 [inline] __x64_sys_unlink+0xc5/0x110 fs/namei.c:4532 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: ffff88803f289f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803f28a000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88803f28a080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88803f28a100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803f28a180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================