syz.7.1363: attempt to access beyond end of device loop7: rw=524288, sector=1056, nr_sectors = 16 limit=16 erofs: (device loop7): z_erofs_readahead: readahead error at page 6 @ nid 89 syz.7.1363: attempt to access beyond end of device loop7: rw=524288, sector=16, nr_sectors = 40 limit=16 ================================================================== BUG: KASAN: use-after-free in memcpy_to_page include/linux/highmem.h:403 [inline] BUG: KASAN: use-after-free in z_erofs_transform_plain+0x3a7/0x4a0 fs/erofs/decompressor.c:347 Read of size 4096 at addr ffff888058195000 by task syz.7.1363/9105 CPU: 0 PID: 9105 Comm: syz.7.1363 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0xa8/0x210 mm/kasan/report.c:420 kasan_report+0x10b/0x140 mm/kasan/report.c:524 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x235/0x290 mm/kasan/generic.c:189 memcpy+0x25/0x60 mm/kasan/shadow.c:65 memcpy_to_page include/linux/highmem.h:403 [inline] z_erofs_transform_plain+0x3a7/0x4a0 fs/erofs/decompressor.c:347 z_erofs_decompress_pcluster fs/erofs/zdata.c:1159 [inline] z_erofs_decompress_queue+0x169e/0x24a0 fs/erofs/zdata.c:1240 z_erofs_runqueue+0x198d/0x1b20 fs/erofs/zdata.c:1603 z_erofs_read_folio+0x35d/0x630 fs/erofs/zdata.c:1693 filemap_read_folio+0x164/0x7a0 mm/filemap.c:2490 filemap_update_page mm/filemap.c:2575 [inline] filemap_get_pages mm/filemap.c:2689 [inline] filemap_read+0x1846/0x3150 mm/filemap.c:2759 generic_file_read_iter+0x124/0x700 mm/filemap.c:2941 __kernel_read+0x2dd/0x6e0 fs/read_write.c:428 integrity_kernel_read+0x86/0xd0 security/integrity/iint.c:228 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0xb12/0x1950 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x503/0xb50 security/integrity/ima/ima_api.c:293 process_measurement+0x119b/0x1c40 security/integrity/ima/ima_main.c:351 ima_file_check+0xc8/0x110 security/integrity/ima/ima_main.c:534 do_open fs/namei.c:3636 [inline] path_openat+0x272b/0x2f10 fs/namei.c:3791 do_filp_open+0x1ee/0x420 fs/namei.c:3818 do_sys_openat2+0x14b/0x4f0 fs/open.c:1320 do_sys_open fs/open.c:1336 [inline] __do_sys_openat fs/open.c:1352 [inline] __se_sys_openat fs/open.c:1347 [inline] __x64_sys_openat+0x135/0x160 fs/open.c:1347 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7ff5da79e0d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff5db6a9028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ff5daa25fa0 RCX: 00007ff5da79e0d9 RDX: 0000000000080000 RSI: 0000200000000100 RDI: ffffffffffffff9c RBP: 00007ff5da835024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ff5daa26038 R14: 00007ff5daa25fa0 R15: 00007ffe6da581a8 The buggy address belongs to the physical page: page:ffffea0001606540 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x58195 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea00008e0ec8 ffffea0000995d08 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x500dc0(GFP_USER|__GFP_ZERO|__GFP_ACCOUNT), pid 6881, tgid 6881 (syz-executor), ts 320563472552, free_ts 321053023902 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2560 prep_new_page mm/page_alloc.c:2567 [inline] get_page_from_freelist+0x206b/0x2180 mm/page_alloc.c:4358 __alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5658 pmd_alloc_one include/asm-generic/pgalloc.h:126 [inline] __pmd_alloc+0xa6/0x760 mm/memory.c:5487 pmd_alloc include/linux/mm.h:2430 [inline] copy_pmd_range mm/memory.c:1157 [inline] copy_pud_range mm/memory.c:1214 [inline] copy_p4d_range mm/memory.c:1238 [inline] copy_page_range+0x35a6/0x3a60 mm/memory.c:1332 dup_mmap kernel/fork.c:703 [inline] dup_mm kernel/fork.c:1548 [inline] copy_mm+0xeb0/0x1680 kernel/fork.c:1597 copy_process+0x19a6/0x40c0 kernel/fork.c:2358 kernel_clone+0x24b/0x900 kernel/fork.c:2765 __do_sys_clone kernel/fork.c:2906 [inline] __se_sys_clone kernel/fork.c:2890 [inline] __x64_sys_clone+0x1a7/0x220 kernel/fork.c:2890 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1487 [inline] free_pcp_prepare mm/page_alloc.c:1537 [inline] free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3414 free_unref_page_list+0xbb/0x8e0 mm/page_alloc.c:3555 release_pages+0x20d1/0x2340 mm/swap.c:1035 tlb_batch_pages_flush mm/mmu_gather.c:60 [inline] tlb_flush_mmu_free mm/mmu_gather.c:255 [inline] tlb_flush_mmu+0x105/0x220 mm/mmu_gather.c:262 tlb_finish_mmu+0xf0/0x220 mm/mmu_gather.c:394 exit_mmap+0x388/0x970 mm/mmap.c:3262 __mmput+0x118/0x3a0 kernel/fork.c:1206 exit_mm+0x24d/0x350 kernel/exit.c:572 do_exit+0x958/0x2570 kernel/exit.c:874 do_group_exit+0x229/0x2e0 kernel/exit.c:1030 __do_sys_exit_group kernel/exit.c:1041 [inline] __se_sys_exit_group kernel/exit.c:1039 [inline] __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1039 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff888058194f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888058194f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888058195000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888058195080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888058195100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================