erofs: (device loop2): mounted with root inode @ nid 36. ================================================================== BUG: KASAN: use-after-free in z_erofs_transform_plain+0x375/0x470 fs/erofs/decompressor.c:356 Read of size 4096 at addr ffff8880929fe000 by task syz-executor.2/21850 CPU: 0 PID: 21850 Comm: syz-executor.2 Not tainted 6.1.79-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/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:356 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_read_folio+0x478/0x760 fs/erofs/zdata.c:1709 filemap_read_folio+0x199/0x780 mm/filemap.c:2461 filemap_update_page mm/filemap.c:2546 [inline] filemap_get_pages mm/filemap.c:2660 [inline] filemap_read+0x1a13/0x31d0 mm/filemap.c:2730 __kernel_read+0x41e/0x8a0 fs/read_write.c:428 integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:228 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x59a/0xc30 security/integrity/ima/ima_api.c:293 process_measurement+0x135c/0x21b0 security/integrity/ima/ima_main.c:351 ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:534 do_open fs/namei.c:3630 [inline] path_openat+0x2687/0x2e60 fs/namei.c:3785 do_filp_open+0x230/0x480 fs/namei.c:3812 do_sys_openat2+0x13b/0x500 fs/open.c:1318 do_sys_open fs/open.c:1334 [inline] __do_sys_open fs/open.c:1342 [inline] __se_sys_open fs/open.c:1338 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1338 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f4525e7dda9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4526ba20c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007f4525fabf80 RCX: 00007f4525e7dda9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000580 RBP: 00007f4525eca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f4525fabf80 R15: 00007ffda5e31b78 The buggy address belongs to the physical page: page:ffffea00024a7f80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x929fe flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0002484048 ffffea00028981c8 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x100cc0(GFP_USER), pid 21340, tgid 21339 (syz-executor.0), ts 648027360926, free_ts 658074287550 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513 prep_new_page mm/page_alloc.c:2520 [inline] get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5545 __get_free_pages+0x8/0x30 mm/page_alloc.c:5595 kasan_populate_vmalloc_pte+0x35/0xf0 mm/kasan/shadow.c:271 apply_to_pte_range mm/memory.c:2645 [inline] apply_to_pmd_range mm/memory.c:2689 [inline] apply_to_pud_range mm/memory.c:2725 [inline] apply_to_p4d_range mm/memory.c:2761 [inline] __apply_to_page_range+0x9c5/0xcc0 mm/memory.c:2795 alloc_vmap_area+0x1977/0x1ac0 mm/vmalloc.c:1646 __get_vm_area_node+0x16c/0x360 mm/vmalloc.c:2505 __vmalloc_node_range+0x394/0x1460 mm/vmalloc.c:3183 alloc_thread_stack_node kernel/fork.c:311 [inline] dup_task_struct+0x3e5/0x6d0 kernel/fork.c:988 copy_process+0x637/0x4060 kernel/fork.c:2098 kernel_clone+0x222/0x920 kernel/fork.c:2682 __do_sys_clone kernel/fork.c:2823 [inline] __se_sys_clone kernel/fork.c:2807 [inline] __x64_sys_clone+0x231/0x280 kernel/fork.c:2807 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1440 [inline] free_pcp_prepare mm/page_alloc.c:1490 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3453 kasan_depopulate_vmalloc_pte+0x66/0x80 mm/kasan/shadow.c:375 apply_to_pte_range mm/memory.c:2645 [inline] apply_to_pmd_range mm/memory.c:2689 [inline] apply_to_pud_range mm/memory.c:2725 [inline] apply_to_p4d_range mm/memory.c:2761 [inline] __apply_to_page_range+0x9c5/0xcc0 mm/memory.c:2795 kasan_release_vmalloc+0x96/0xb0 mm/kasan/shadow.c:492 __purge_vmap_area_lazy+0x157c/0x1720 mm/vmalloc.c:1774 drain_vmap_area_work+0x3c/0xd0 mm/vmalloc.c:1803 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Memory state around the buggy address: ffff8880929fdf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880929fdf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880929fe000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880929fe080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880929fe100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================