loop0: detected capacity change from 0 to 16 erofs: (device loop0): mounted with root inode @ nid 36. ================================================================== BUG: KASAN: use-after-free in z_erofs_transform_plain+0x359/0x430 fs/erofs/decompressor.c:355 Read of size 4096 at addr ffff888025f20000 by task syz-executor243/3636 CPU: 0 PID: 3636 Comm: syz-executor243 Not tainted 6.1.0-rc7-syzkaller-00123-ga4412fdd49dc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:284 print_report+0x107/0x220 mm/kasan/report.c:395 kasan_report+0x139/0x170 mm/kasan/report.c:495 kasan_check_range+0x2a7/0x2e0 mm/kasan/generic.c:189 memcpy+0x25/0x60 mm/kasan/shadow.c:65 z_erofs_transform_plain+0x359/0x430 fs/erofs/decompressor.c:355 z_erofs_decompress_pcluster fs/erofs/zdata.c:1068 [inline] z_erofs_decompress_queue+0x18f9/0x2c10 fs/erofs/zdata.c:1155 z_erofs_runqueue fs/erofs/zdata.c:1536 [inline] z_erofs_read_folio+0x458/0x640 fs/erofs/zdata.c:1631 filemap_read_folio+0x1ba/0x7f0 mm/filemap.c:2407 filemap_update_page+0x3ca/0x550 mm/filemap.c:2492 filemap_get_pages+0x8d8/0x1110 mm/filemap.c:2605 filemap_read+0x3e7/0xee0 mm/filemap.c:2675 __kernel_read+0x3c4/0x7e0 fs/read_write.c:428 integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:199 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+0x17d1/0x1cb0 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x47f/0x8d0 security/integrity/ima/ima_api.c:292 process_measurement+0xd60/0x1b10 security/integrity/ima/ima_main.c:337 ima_file_check+0xe7/0x160 security/integrity/ima/ima_main.c:517 do_open fs/namei.c:3559 [inline] path_openat+0x2654/0x2e00 fs/namei.c:3714 do_filp_open+0x275/0x500 fs/namei.c:3741 do_sys_openat2+0x13b/0x500 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_open fs/open.c:1334 [inline] __se_sys_open fs/open.c:1330 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1330 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f267a8fde49 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 d1 17 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffe7418b238 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 0032656c69662f2e RCX: 00007f267a8fde49 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000100 RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000140 R10: 00007ffe7418b100 R11: 0000000000000246 R12: 00007ffe7418b270 R13: 00007ffe7418b350 R14: 431bde82d7b634db R15: 00007ffe7418b250 Allocated by task 3421: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:52 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] kmem_cache_alloc_node+0x1ca/0x340 mm/slub.c:3443 alloc_task_struct_node kernel/fork.c:171 [inline] dup_task_struct+0x4e/0x490 kernel/fork.c:966 copy_process+0x637/0x3fc0 kernel/fork.c:2084 kernel_clone+0x227/0x640 kernel/fork.c:2671 __do_sys_clone kernel/fork.c:2812 [inline] __se_sys_clone kernel/fork.c:2796 [inline] __x64_sys_clone+0x276/0x2e0 kernel/fork.c:2796 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 3421: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:511 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] kmem_cache_free+0x94/0x1d0 mm/slub.c:3683 rcu_do_batch kernel/rcu/tree.c:2250 [inline] rcu_core+0xa91/0x1790 kernel/rcu/tree.c:2510 __do_softirq+0x277/0x75b kernel/softirq.c:571 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:481 call_rcu+0x163/0xa00 kernel/rcu/tree.c:2798 release_task+0x1663/0x1880 wait_task_zombie kernel/exit.c:1136 [inline] wait_consider_task+0x196c/0x2cd0 kernel/exit.c:1363 do_wait_pid kernel/exit.c:1494 [inline] do_wait+0x525/0x9d0 kernel/exit.c:1536 kernel_wait4+0x29c/0x3e0 kernel/exit.c:1706 __do_sys_wait4 kernel/exit.c:1734 [inline] __se_sys_wait4 kernel/exit.c:1730 [inline] __x64_sys_wait4+0x130/0x1e0 kernel/exit.c:1730 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:481 call_rcu+0x163/0xa00 kernel/rcu/tree.c:2798 release_task+0x1663/0x1880 wait_task_zombie kernel/exit.c:1136 [inline] wait_consider_task+0x196c/0x2cd0 kernel/exit.c:1363 do_wait_pid kernel/exit.c:1494 [inline] do_wait+0x525/0x9d0 kernel/exit.c:1536 kernel_wait4+0x29c/0x3e0 kernel/exit.c:1706 __do_sys_wait4 kernel/exit.c:1734 [inline] __se_sys_wait4 kernel/exit.c:1730 [inline] __x64_sys_wait4+0x130/0x1e0 kernel/exit.c:1730 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888025f20000 which belongs to the cache task_struct of size 7232 The buggy address is located 0 bytes inside of 7232-byte region [ffff888025f20000, ffff888025f21c40) The buggy address belongs to the physical page: page:ffffea000097c800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25f20 head:ffffea000097c800 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea00007c7800 dead000000000003 ffff8881400073c0 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 11, tgid 11 (kworker/u4:1), ts 9058544750, free_ts 0 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4291 __alloc_pages+0x259/0x560 mm/page_alloc.c:5558 alloc_slab_page+0x70/0xf0 mm/slub.c:1794 allocate_slab+0x5e/0x4b0 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0x7f4/0xeb0 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] kmem_cache_alloc_node+0x283/0x340 mm/slub.c:3443 alloc_task_struct_node kernel/fork.c:171 [inline] dup_task_struct+0x4e/0x490 kernel/fork.c:966 copy_process+0x637/0x3fc0 kernel/fork.c:2084 kernel_clone+0x227/0x640 kernel/fork.c:2671 user_mode_thread+0x12d/0x190 kernel/fork.c:2747 call_usermodehelper_exec_work+0x57/0x220 kernel/umh.c:175 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436 kthread+0x266/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 page_owner free stack trace missing Memory state around the buggy address: ffff888025f1ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888025f1ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888025f20000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888025f20080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888025f20100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================