syz.4.288: attempt to access beyond end of device loop4: rw=524288, sector=32, nr_sectors = 64 limit=16 syz.4.288: attempt to access beyond end of device loop4: rw=524288, sector=16, nr_sectors = 16 limit=16 syz.4.288: attempt to access beyond end of device loop4: rw=524288, sector=14425508768, nr_sectors = 8 limit=16 ================================================================== BUG: KASAN: use-after-free in z_erofs_transform_plain+0x375/0x470 fs/erofs/decompressor.c:350 Read of size 1622 at addr ffff88801e74de5b by task syz.4.288/4864 CPU: 1 PID: 4864 Comm: syz.4.288 Not tainted 6.1.110-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189 memcpy+0x25/0x60 mm/kasan/shadow.c:65 z_erofs_transform_plain+0x375/0x470 fs/erofs/decompressor.c:350 z_erofs_decompress_pcluster fs/erofs/zdata.c:1173 [inline] z_erofs_decompress_queue+0x1aa0/0x2d50 fs/erofs/zdata.c:1256 z_erofs_runqueue+0x1a6e/0x1ca0 fs/erofs/zdata.c:1614 z_erofs_readahead+0xc26/0x1030 fs/erofs/zdata.c:1758 read_pages+0x17f/0x830 mm/readahead.c:161 page_cache_ra_unbounded+0x68b/0x7b0 mm/readahead.c:270 do_page_cache_ra mm/readahead.c:300 [inline] force_page_cache_ra+0x2a3/0x300 mm/readahead.c:331 force_page_cache_readahead mm/internal.h:106 [inline] generic_fadvise+0x553/0x7b0 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+0x138/0x180 mm/fadvise.c:212 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7fd2a917def9 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:00007fd2a9fc0038 EFLAGS: 00000246 ORIG_RAX: 00000000000000dd RAX: ffffffffffffffda RBX: 00007fd2a9336058 RCX: 00007fd2a917def9 RDX: 0000000000000000 RSI: 000000000000fcff RDI: 0000000000000009 RBP: 00007fd2a91f0b76 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000001 R14: 00007fd2a9336058 R15: 00007ffde329d8d8 The buggy address belongs to the physical page: page:ffffea000079d340 refcount:2 mapcount:0 mapping:ffff8880582e8270 index:0x1 pfn:0x1e74d memcg:ffff888057060000 aops:managed_cache_aops ino:0 flags: 0xfff40000002014(uptodate|lru|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff40000002014 ffffea0001383b88 ffffea0000ad4a48 ffff8880582e8270 raw: 0000000000000001 ffff8880583f5000 00000002ffffffff ffff888057060000 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 4846, tgid 4844 (syz.4.288), ts 116628351577, free_ts 116626383317 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517 prep_new_page mm/page_alloc.c:2524 [inline] get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4290 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5558 z_erofs_bind_cache fs/erofs/zdata.c:482 [inline] z_erofs_do_read_page+0x1a76/0x3bd0 fs/erofs/zdata.c:858 z_erofs_read_folio+0x31a/0x760 fs/erofs/zdata.c:1703 filemap_read_folio+0x199/0x780 mm/filemap.c:2461 do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3598 erofs_bread+0x149/0x610 fs/erofs/data.c:46 find_target_block_classic fs/erofs/namei.c:108 [inline] erofs_namei+0x1ad/0xca0 fs/erofs/namei.c:184 erofs_lookup+0x1d6/0x4d0 fs/erofs/namei.c:212 lookup_open fs/namei.c:3462 [inline] open_last_lookups fs/namei.c:3552 [inline] path_openat+0x10fb/0x2e60 fs/namei.c:3782 do_filp_open+0x230/0x480 fs/namei.c:3812 do_sys_openat2+0x13b/0x4f0 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+0x243/0x290 fs/open.c:1345 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 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:1444 [inline] free_pcp_prepare mm/page_alloc.c:1494 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3464 __vunmap+0x834/0x9a0 mm/vmalloc.c:2717 bpf_check+0xf721/0x16140 kernel/bpf/verifier.c:15710 bpf_prog_load+0x12df/0x1bb0 kernel/bpf/syscall.c:2646 __sys_bpf+0x382/0x6c0 kernel/bpf/syscall.c:5020 __do_sys_bpf kernel/bpf/syscall.c:5124 [inline] __se_sys_bpf kernel/bpf/syscall.c:5122 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5122 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff88801e74df00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88801e74df80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88801e74e000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88801e74e080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88801e74e100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================