syz.2.20: attempt to access beyond end of device loop2: rw=524288, sector=16, nr_sectors = 8 limit=16 syz.2.20: attempt to access beyond end of device loop2: rw=524288, sector=13716630376, nr_sectors = 8 limit=16 ================================================================== BUG: KASAN: slab-out-of-bounds in z_erofs_transform_plain+0x37a/0x490 fs/erofs/decompressor.c:350 Read of size 4095 at addr ffff8880312d2400 by task syz.2.20/4456 CPU: 0 PID: 4456 Comm: syz.2.20 Not tainted 6.1.141-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/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/0x220 mm/kasan/report.c:427 kasan_report+0x10b/0x140 mm/kasan/report.c:531 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 z_erofs_transform_plain+0x37a/0x490 fs/erofs/decompressor.c:350 z_erofs_decompress_pcluster fs/erofs/zdata.c:1175 [inline] z_erofs_decompress_queue+0x1577/0x2370 fs/erofs/zdata.c:1258 z_erofs_runqueue+0x1a83/0x1bc0 fs/erofs/zdata.c:1616 z_erofs_readahead+0xa36/0xdc0 fs/erofs/zdata.c:1760 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:0x7fa88ed8e929 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:00007fa88ebde038 EFLAGS: 00000246 ORIG_RAX: 00000000000000dd RAX: ffffffffffffffda RBX: 00007fa88efb6080 RCX: 00007fa88ed8e929 RDX: 000000000000ff39 RSI: 000000000000aa1f RDI: 0000000000000005 RBP: 00007fa88ee10b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fa88efb6080 R15: 00007ffc5d0a62a8 The buggy address belongs to the physical page: page:ffffea0000c4b480 refcount:2 mapcount:0 mapping:ffff8880557f07c8 index:0x1 pfn:0x312d2 memcg:ffff888054b4c000 aops:managed_cache_aops ino:0 flags: 0xfff40000002014(uptodate|lru|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff40000002014 ffffea0001e32908 ffffea00014df688 ffff8880557f07c8 raw: 0000000000000001 ffff88807289f000 00000002ffffffff ffff888054b4c000 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 4434, tgid 4433 (syz.2.20), ts 96983366136, free_ts 96975618056 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:482 [inline] z_erofs_do_read_page+0x19be/0x39e0 fs/erofs/zdata.c:860 z_erofs_read_folio+0x256/0x5c0 fs/erofs/zdata.c:1705 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_slow+0x27d/0x3a0 fs/namei.c:1690 lookup_slow+0x53/0x70 fs/namei.c:1707 walk_component fs/namei.c:1998 [inline] link_path_walk+0x928/0xe50 fs/namei.c:2325 path_openat+0x276/0x2e70 fs/namei.c:3779 do_filp_open+0x1c1/0x3c0 fs/namei.c:3810 do_sys_openat2+0x142/0x490 fs/open.c:1318 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 __vunmap+0x856/0xa00 mm/vmalloc.c:2718 kvm_destroy_vm virt/kvm/kvm_main.c:1344 [inline] kvm_put_kvm+0x14a3/0x1950 virt/kvm/kvm_main.c:1370 kvm_vm_release+0x42/0x50 virt/kvm/kvm_main.c:1393 __fput+0x22c/0x920 fs/file_table.c:320 task_work_run+0x1ca/0x250 kernel/task_work.c:203 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff8880312d2f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880312d3000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880312d3080: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ^ ffff8880312d3100: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880312d3180: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc ==================================================================