syz.1.2: attempt to access beyond end of device loop1: rw=524288, sector=32, nr_sectors = 64 limit=16 syz.1.2: attempt to access beyond end of device loop1: rw=524288, sector=16, nr_sectors = 16 limit=16 syz.1.2: attempt to access beyond end of device loop1: rw=524288, sector=14425508768, nr_sectors = 8 limit=16 ================================================================== BUG: KASAN: slab-out-of-bounds in z_erofs_transform_plain+0x375/0x470 fs/erofs/decompressor.c:350 Read of size 1622 at addr ffff888026e7ae5b by task syz.1.2/4353 CPU: 0 PID: 4353 Comm: syz.1.2 Not tainted 6.1.119-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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:1175 [inline] z_erofs_decompress_queue+0x1aa0/0x2d50 fs/erofs/zdata.c:1258 z_erofs_runqueue+0x1bfe/0x1e10 fs/erofs/zdata.c:1616 z_erofs_readahead+0xc26/0x1030 fs/erofs/zdata.c:1760 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:125 [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:0x7f4015d7ff19 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:00007f4016b99058 EFLAGS: 00000246 ORIG_RAX: 00000000000000dd RAX: ffffffffffffffda RBX: 00007f4015f45fa0 RCX: 00007f4015d7ff19 RDX: 040000000001060f RSI: 0000000000000004 RDI: 0000000000000004 RBP: 00007f4015df3986 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f4015f45fa0 R15: 00007ffd46242b18 The buggy address belongs to the physical page: page:ffffea00009b9e80 refcount:2 mapcount:0 mapping:ffff888059fd87c8 index:0x1 pfn:0x26e7a memcg:ffff888027d26000 aops:managed_cache_aops ino:0 flags: 0xfff40000002014(uptodate|lru|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff40000002014 ffffea0001c559c8 ffffea0001a3b148 ffff888059fd87c8 raw: 0000000000000001 ffff888028242000 00000002ffffffff ffff888027d26000 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 4353, tgid 4350 (syz.1.2), ts 65890070577, free_ts 65886734448 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+0x3731/0x38d0 mm/page_alloc.c:4313 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5590 z_erofs_bind_cache fs/erofs/zdata.c:482 [inline] z_erofs_do_read_page+0x19da/0x3d00 fs/erofs/zdata.c:860 z_erofs_read_folio+0x31a/0x760 fs/erofs/zdata.c:1705 filemap_read_folio+0x199/0x780 mm/filemap.c:2489 do_read_cache_folio+0x2ee/0x810 mm/filemap.c:3626 erofs_bread+0x19d/0x6b0 fs/erofs/data.c:50 erofs_find_target_block fs/erofs/namei.c:102 [inline] erofs_namei+0x278/0xef0 fs/erofs/namei.c:175 erofs_lookup+0x1d6/0x4d0 fs/erofs/namei.c:204 lookup_open fs/namei.c:3460 [inline] open_last_lookups fs/namei.c:3550 [inline] path_openat+0x10fb/0x2e60 fs/namei.c:3780 do_filp_open+0x230/0x480 fs/namei.c:3810 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 free_slab mm/slub.c:2031 [inline] discard_slab mm/slub.c:2037 [inline] __unfreeze_partials+0x1b7/0x210 mm/slub.c:2586 put_cpu_partial+0x17b/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+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: ffff888026e7af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888026e7af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888026e7b000: 06 fc fc fc fc 00 fc fc fc fc 05 fc fc fc fc 07 ^ ffff888026e7b080: fc fc fc fc 07 fc fc fc fc 07 fc fc fc fc 07 fc ffff888026e7b100: fc fc fc 07 fc fc fc fc 07 fc fc fc fc 05 fc fc ==================================================================