loop3: rw=524288, sector=32, nr_sectors = 64 limit=16 syz.3.147: attempt to access beyond end of device loop3: rw=524288, sector=16, nr_sectors = 16 limit=16 syz.3.147: attempt to access beyond end of device loop3: 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 ffff88805ad7ee5b by task syz.3.147/4449 CPU: 1 PID: 4449 Comm: syz.3.147 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:0x7fbb31d7def9 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:00007fbb32abb038 EFLAGS: 00000246 ORIG_RAX: 00000000000000dd RAX: ffffffffffffffda RBX: 00007fbb31f36130 RCX: 00007fbb31d7def9 RDX: 0000000000000000 RSI: 000000000000fcff RDI: 0000000000000004 RBP: 00007fbb31df0b76 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fbb31f36130 R15: 00007ffead3a4e78 The buggy address belongs to the physical page: page:ffffea00016b5f80 refcount:2 mapcount:0 mapping:ffff8880593f87c8 index:0x1 pfn:0x5ad7e memcg:ffff888058db4000 aops:managed_cache_aops ino:0 flags: 0xfff40000002014(uptodate|lru|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff40000002014 ffffea00012cdf48 ffffea0001343788 ffff8880593f87c8 raw: 0000000000000001 ffff888059315000 00000002ffffffff ffff888058db4000 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 4441, tgid 4440 (syz.3.147), ts 122948042321, free_ts 122927604155 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 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422 getname_flags+0xb8/0x4f0 fs/namei.c:139 vfs_fstatat fs/stat.c:266 [inline] __do_sys_newfstatat fs/stat.c:437 [inline] __se_sys_newfstatat fs/stat.c:431 [inline] __x64_sys_newfstatat+0x130/0x1e0 fs/stat.c:431 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: ffff88805ad7ef00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88805ad7ef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88805ad7f000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805ad7f080: fb fb fb fb fb fc fc fc fc fc fc fc fc fb fb fb ffff88805ad7f100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================