================================================================== 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+0x388/0x460 fs/erofs/decompressor.c:346 Read of size 4095 at addr ffff88805686a400 by task syz.1.445/6317 CPU: 0 PID: 6317 Comm: syz.1.445 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Call Trace: dump_stack_lvl+0x168/0x22e 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+0x27b/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+0x388/0x460 fs/erofs/decompressor.c:346 z_erofs_decompress_pcluster fs/erofs/zdata.c:1159 [inline] z_erofs_decompress_queue+0x1690/0x24b0 fs/erofs/zdata.c:1240 z_erofs_runqueue+0x19a9/0x1af0 fs/erofs/zdata.c:1597 z_erofs_readahead+0xa3b/0xda0 fs/erofs/zdata.c:1733 read_pages+0x173/0x840 mm/readahead.c:161 page_cache_ra_unbounded+0x690/0x770 mm/readahead.c:270 do_page_cache_ra mm/readahead.c:300 [inline] force_page_cache_ra+0x2bd/0x320 mm/readahead.c:331 force_page_cache_readahead mm/internal.h:125 [inline] generic_fadvise+0x44e/0x6c0 mm/fadvise.c:107 vfs_fadvise mm/fadvise.c:185 [inline] ksys_fadvise64_64 mm/fadvise.c:199 [inline] __do_sys_fadvise64 mm/fadvise.c:214 [inline] __se_sys_fadvise64 mm/fadvise.c:212 [inline] __x64_sys_fadvise64+0x139/0x180 mm/fadvise.c:212 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f343d58efc9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f343e489038 EFLAGS: 00000246 ORIG_RAX: 00000000000000dd RAX: ffffffffffffffda RBX: 00007f343d7e5fa0 RCX: 00007f343d58efc9 RDX: 000000000000ff39 RSI: 000000000000aa17 RDI: 0000000000000004 RBP: 00007f343d611f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f343d7e6038 R14: 00007f343d7e5fa0 R15: 00007ffd1f545538 The buggy address belongs to the physical page: page:ffffea00015a1a80 refcount:2 mapcount:0 mapping:ffff888054aa07c8 index:0x1 pfn:0x5686a memcg:ffff888074182000 aops:managed_cache_aops ino:0 flags: 0xfff40000002014(uptodate|lru|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff40000002014 ffffea0001730c48 ffffea0001476ec8 ffff888054aa07c8 raw: 0000000000000001 ffff888054968000 00000002ffffffff ffff888074182000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x192840(GFP_NOWAIT|__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 6317, tgid 6315 (syz.1.445), ts 340272453441, free_ts 340262357242 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328 __alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5614 z_erofs_bind_cache fs/erofs/zdata.c:487 [inline] z_erofs_do_read_page+0x1a4e/0x3a20 fs/erofs/zdata.c:862 z_erofs_read_folio+0x246/0x5b0 fs/erofs/zdata.c:1682 filemap_read_folio+0x160/0x760 mm/filemap.c:2490 do_read_cache_folio+0x2a0/0x760 mm/filemap.c:3627 erofs_bread+0x18e/0x670 fs/erofs/data.c:50 erofs_find_target_block fs/erofs/namei.c:102 [inline] erofs_namei+0x28f/0xf00 fs/erofs/namei.c:175 erofs_lookup+0x14b/0x390 fs/erofs/namei.c:204 lookup_one_qstr_excl+0x10e/0x240 fs/namei.c:1613 filename_create+0x21e/0x450 fs/namei.c:3885 do_mkdirat+0x9d/0x430 fs/namei.c:4129 __do_sys_mkdirat fs/namei.c:4154 [inline] __se_sys_mkdirat fs/namei.c:4152 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4152 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 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:1459 [inline] free_pcp_prepare mm/page_alloc.c:1509 [inline] free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384 free_unref_page_list+0xbb/0x8e0 mm/page_alloc.c:3525 release_pages+0x1f92/0x2200 mm/swap.c:1035 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline] tlb_flush_mmu_free mm/mmu_gather.c:254 [inline] tlb_flush_mmu+0xff/0x210 mm/mmu_gather.c:261 tlb_finish_mmu+0xbd/0x1c0 mm/mmu_gather.c:361 exit_mmap+0x343/0x8e0 mm/mmap.c:3262 __mmput+0x118/0x3c0 kernel/fork.c:1200 exit_mm+0x1e6/0x2c0 kernel/exit.c:565 do_exit+0x8c1/0x2400 kernel/exit.c:867 do_group_exit+0x217/0x2d0 kernel/exit.c:1022 __do_sys_exit_group kernel/exit.c:1033 [inline] __se_sys_exit_group kernel/exit.c:1031 [inline] __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1031 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff88805686af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88805686af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88805686b000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805686b080: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc ffff88805686b100: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================