================================================================== 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 ffff888055f5a400 by task syz.4.122/4904 CPU: 1 PID: 4904 Comm: syz.4.122 Not tainted 6.1.148-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/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+0x19d4/0x1af0 fs/erofs/zdata.c:1606 z_erofs_read_folio+0x321/0x5b0 fs/erofs/zdata.c:1687 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_open fs/namei.c:3460 [inline] open_last_lookups fs/namei.c:3550 [inline] path_openat+0xfaf/0x2e70 fs/namei.c:3780 do_filp_open+0x1c1/0x3c0 fs/namei.c:3810 do_sys_openat2+0x142/0x490 fs/open.c:1318 do_sys_open fs/open.c:1334 [inline] __do_sys_openat fs/open.c:1350 [inline] __se_sys_openat fs/open.c:1345 [inline] __x64_sys_openat+0x135/0x160 fs/open.c:1345 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:0x7ff98558ebe9 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:00007ff9837f6038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ff9857b6090 RCX: 00007ff98558ebe9 RDX: 0000000000000000 RSI: 0000200000000480 RDI: 0000000000000004 RBP: 00007ff985611e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ff9857b6128 R14: 00007ff9857b6090 R15: 00007ffecf7b9568 The buggy address belongs to the physical page: page:ffffea000157d680 refcount:2 mapcount:0 mapping:ffff888054c707c8 index:0x1 pfn:0x55f5a memcg:ffff8880798cc000 aops:managed_cache_aops ino:0 flags: 0xfff40000002014(uptodate|lru|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff40000002014 ffffea00006092c8 ffff8880798ce1f8 ffff888054c707c8 raw: 0000000000000001 ffff888054e48000 00000002ffffffff ffff8880798cc000 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 4904, tgid 4896 (syz.4.122), ts 131817949061, free_ts 129942338322 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_open fs/namei.c:3460 [inline] open_last_lookups fs/namei.c:3550 [inline] path_openat+0xfaf/0x2e70 fs/namei.c:3780 do_filp_open+0x1c1/0x3c0 fs/namei.c:3810 do_sys_openat2+0x142/0x490 fs/open.c:1318 do_sys_open fs/open.c:1334 [inline] __do_sys_openat fs/open.c:1350 [inline] __se_sys_openat fs/open.c:1345 [inline] __x64_sys_openat+0x135/0x160 fs/open.c:1345 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+0x2e/0x3f0 mm/page_alloc.c:3479 free_slab mm/slub.c:2031 [inline] discard_slab mm/slub.c:2037 [inline] __unfreeze_partials+0x1a5/0x200 mm/slub.c:2586 put_cpu_partial+0x17c/0x250 mm/slub.c:2662 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] __kmem_cache_alloc_node+0x140/0x260 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:935 [inline] __kmalloc+0xa0/0x240 mm/slab_common.c:949 kmalloc include/linux/slab.h:568 [inline] kzalloc include/linux/slab.h:699 [inline] tomoyo_encode2 security/tomoyo/realpath.c:45 [inline] tomoyo_encode+0x27e/0x540 security/tomoyo/realpath.c:80 tomoyo_path_perm+0x2aa/0x550 security/tomoyo/file.c:831 tomoyo_path_symlink+0xa0/0xe0 security/tomoyo/tomoyo.c:199 security_path_symlink+0xdc/0x130 security/security.c:1198 do_symlinkat+0x104/0x3f0 fs/namei.c:4495 __do_sys_symlink fs/namei.c:4522 [inline] __se_sys_symlink fs/namei.c:4520 [inline] __x64_sys_symlink+0x7a/0x90 fs/namei.c:4520 Memory state around the buggy address: ffff888055f5af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888055f5af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888055f5b000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888055f5b080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc ffff888055f5b100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ==================================================================