================================================================== BUG: KASAN: use-after-free in F2FS_SB fs/f2fs/f2fs.h:1908 [inline] BUG: KASAN: use-after-free in F2FS_I_SB fs/f2fs/f2fs.h:1913 [inline] BUG: KASAN: use-after-free in F2FS_M_SB fs/f2fs/f2fs.h:1918 [inline] BUG: KASAN: use-after-free in F2FS_P_SB fs/f2fs/f2fs.h:1923 [inline] BUG: KASAN: use-after-free in f2fs_release_page+0x318/0xb90 fs/f2fs/data.c:3775 Read of size 8 at addr ffff88816c1063c8 by task syz-executor.3/26619 CPU: 1 PID: 26619 Comm: syz-executor.3 Tainted: G W 5.10.161-syzkaller-00019-g416c4356f372 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3c0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 F2FS_SB fs/f2fs/f2fs.h:1908 [inline] F2FS_I_SB fs/f2fs/f2fs.h:1913 [inline] F2FS_M_SB fs/f2fs/f2fs.h:1918 [inline] F2FS_P_SB fs/f2fs/f2fs.h:1923 [inline] f2fs_release_page+0x318/0xb90 fs/f2fs/data.c:3775 try_to_release_page+0x1bd/0x210 mm/filemap.c:3664 shrink_page_list+0x240a/0x3c60 mm/vmscan.c:1453 shrink_inactive_list+0x38f/0xcd0 mm/vmscan.c:2016 shrink_list mm/vmscan.c:2240 [inline] shrink_lruvec+0x499/0xa50 mm/vmscan.c:2558 shrink_node_memcgs+0x44f/0x9a0 mm/vmscan.c:2749 shrink_node+0xce1/0x1b30 mm/vmscan.c:2866 shrink_zones+0x48d/0x960 mm/vmscan.c:3069 do_try_to_free_pages+0x217/0xa50 mm/vmscan.c:3125 try_to_free_mem_cgroup_pages+0x3a2/0x840 mm/vmscan.c:3443 try_charge+0x4a5/0x1020 mm/memcontrol.c:2774 __mem_cgroup_charge+0x12d/0x720 mm/memcontrol.c:6847 mem_cgroup_charge include/linux/memcontrol.h:456 [inline] __add_to_page_cache_locked+0x2bc/0xb30 mm/filemap.c:854 add_to_page_cache_lru+0x116/0x2b0 mm/filemap.c:948 pagecache_get_page+0x62c/0x850 mm/filemap.c:1859 grab_cache_page_write_begin+0x5c/0xa0 mm/filemap.c:3418 ext4_da_write_begin+0x5c2/0xf10 fs/ext4/inode.c:3056 generic_perform_write+0x309/0x5b0 mm/filemap.c:3468 ext4_buffered_write_iter+0x47c/0x610 fs/ext4/file.c:272 ext4_file_write_iter+0x192/0x1c70 fs/ext4/file.c:689 __kernel_write+0x5ad/0x9d0 fs/read_write.c:550 dump_emit fs/coredump.c:849 [inline] dump_user_range+0x25b/0x3b0 fs/coredump.c:902 elf_core_dump+0x3156/0x3cd0 fs/binfmt_elf.c:2287 do_coredump+0x1f7c/0x2dc0 fs/coredump.c:811 get_signal+0xdde/0x1440 kernel/signal.c:2774 arch_do_signal+0x8e/0x650 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop+0xa3/0xe0 kernel/entry/common.c:161 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] irqentry_exit_to_user_mode+0x56/0x80 kernel/entry/common.c:279 irqentry_exit+0x12/0x60 kernel/entry/common.c:367 exc_page_fault+0x7e/0x1b0 arch/x86/mm/fault.c:1521 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:571 RIP: 0033:0x7f48b24a40d1 Code: c4 28 c3 e8 f1 19 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 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f RSP: 002b:0000000020002d50 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 00007f48b25c3f80 RCX: 00007f48b24a40c9 RDX: 0000000020002d80 RSI: 0000000020002d50 RDI: 0000000000080040 RBP: 00007f48b24ffae9 R08: 0000000020002e00 R09: 0000000020002e00 R10: 0000000020002dc0 R11: 0000000000000202 R12: 0000000000000000 R13: 00007ffc0527908f R14: 00007f48b1217300 R15: 0000000000022000 Allocated by task 3526: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] __kmalloc+0x1f7/0x360 mm/slub.c:4042 __kmalloc_node include/linux/slab.h:418 [inline] kmalloc_node include/linux/slab.h:575 [inline] kvmalloc_node+0x82/0x130 mm/util.c:612 kvmalloc include/linux/mm.h:822 [inline] kvmalloc_array include/linux/mm.h:840 [inline] alloc_fdtable+0xce/0x270 fs/file.c:134 dup_fd+0x781/0xa40 fs/file.c:352 copy_files+0xe6/0x200 kernel/fork.c:1518 copy_process+0x128a/0x33a0 kernel/fork.c:2140 kernel_clone+0x22d/0x900 kernel/fork.c:2524 __do_sys_clone kernel/fork.c:2643 [inline] __se_sys_clone kernel/fork.c:2627 [inline] __x64_sys_clone+0x271/0x2e0 kernel/fork.c:2627 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Freed by task 26556: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 kvfree+0x35/0x40 mm/util.c:647 __free_fdtable fs/file.c:34 [inline] put_files_struct+0x297/0x330 fs/file.c:462 exit_files+0x80/0xa0 fs/file.c:487 do_exit+0x607/0x2340 kernel/exit.c:808 do_group_exit+0x13a/0x300 kernel/exit.c:910 get_signal+0xe17/0x1440 kernel/signal.c:2780 arch_do_signal+0x8e/0x650 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop+0xa3/0xe0 kernel/entry/common.c:161 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] syscall_exit_to_user_mode+0x77/0xa0 kernel/entry/common.c:266 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xca/0xf0 mm/kasan/generic.c:345 insert_work+0x56/0x330 kernel/workqueue.c:1348 __queue_work+0x971/0xd30 kernel/workqueue.c:1514 queue_work_on+0xf2/0x150 kernel/workqueue.c:1541 queue_work include/linux/workqueue.h:513 [inline] schedule_work include/linux/workqueue.h:574 [inline] destroy_super_rcu+0xea/0x100 fs/super.c:172 rcu_do_batch+0x59e/0xc40 kernel/rcu/tree.c:2485 rcu_core+0x59b/0xe30 kernel/rcu/tree.c:2726 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2739 __do_softirq+0x27e/0x596 kernel/softirq.c:305 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xca/0xf0 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:2967 [inline] call_rcu+0x140/0x1300 kernel/rcu/tree.c:3041 __put_super+0x24c/0x2a0 fs/super.c:299 put_super fs/super.c:313 [inline] deactivate_locked_super+0xe4/0x100 fs/super.c:346 deactivate_super+0xa5/0xd0 fs/super.c:366 cleanup_mnt+0x45f/0x510 fs/namespace.c:1118 __cleanup_mnt+0x19/0x20 fs/namespace.c:1125 task_work_run+0x147/0x1b0 kernel/task_work.c:154 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xc8/0xe0 kernel/entry/common.c:164 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] syscall_exit_to_user_mode+0x77/0xa0 kernel/entry/common.c:266 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x61/0xc6 The buggy address belongs to the object at ffff88816c106000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 968 bytes inside of 2048-byte region [ffff88816c106000, ffff88816c106800) The buggy address belongs to the page: page:ffffea0005b04000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x16c100 head:ffffea0005b04000 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff888100042d80 raw: 0000000000000000 0000000000080008 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 22559, ts 1695572726305, free_ts 1570457630468 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2386 [inline] prep_new_page mm/page_alloc.c:2392 [inline] get_page_from_freelist+0x755/0x810 mm/page_alloc.c:4073 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5160 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x78/0x540 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2636 [inline] ___slab_alloc+0x131/0x2e0 mm/slub.c:2800 __slab_alloc+0x63/0xa0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc_trace+0x20e/0x330 mm/slub.c:2981 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] copy_verifier_state+0x780/0xfe0 kernel/bpf/verifier.c:899 push_stack+0x1a9/0x730 kernel/bpf/verifier.c:975 check_cond_jmp_op kernel/bpf/verifier.c:8039 [inline] do_check+0xb2ca/0xd4f0 kernel/bpf/verifier.c:10054 do_check_common+0x8a0/0x18a0 kernel/bpf/verifier.c:11803 do_check_main kernel/bpf/verifier.c:11866 [inline] bpf_check+0xe872/0x10fe0 kernel/bpf/verifier.c:12421 bpf_prog_load+0x12b0/0x1b70 kernel/bpf/syscall.c:2233 __do_sys_bpf+0x441/0x6c0 kernel/bpf/syscall.c:4429 __se_sys_bpf kernel/bpf/syscall.c:4385 [inline] __x64_sys_bpf+0x7a/0x90 kernel/bpf/syscall.c:4385 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1332 [inline] free_pcp_prepare+0x18c/0x1c0 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3293 [inline] free_unref_page+0x6a/0x220 mm/page_alloc.c:3347 __put_single_page mm/swap.c:102 [inline] __put_page+0xb1/0xd0 mm/swap.c:133 put_page include/linux/mm.h:1255 [inline] aio_free_ring+0x28d/0x370 fs/aio.c:319 free_ioctx+0x1b/0x70 fs/aio.c:589 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 Memory state around the buggy address: ffff88816c106280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88816c106300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88816c106380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88816c106400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88816c106480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== general protection fault, probably for non-canonical address 0xdffffc00000000db: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x00000000000006d8-0x00000000000006df] CPU: 1 PID: 26619 Comm: syz-executor.3 Tainted: G B W 5.10.161-syzkaller-00019-g416c4356f372 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 RIP: 0010:f2fs_release_page+0x328/0xb90 fs/f2fs/data.c:3775 Code: 00 4c 03 23 4c 89 e0 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 e7 e8 48 e3 92 ff bb d8 06 00 00 49 03 1c 24 48 89 d8 48 c1 e8 03 <42> 8a 04 28 84 c0 0f 85 c9 07 00 00 44 8b 33 bb 00 00 00 40 be 00 RSP: 0018:ffffc9000c70da00 EFLAGS: 00010206 RAX: 00000000000000db RBX: 00000000000006d8 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000282 RDI: 0000000000000001 RBP: ffffc9000c70da48 R08: ffffffff813f3353 R09: fffffbfff0d864f9 R10: fffffbfff0d864f9 R11: 1ffffffff0d864f8 R12: ffff88816c1063c8 R13: dffffc0000000000 R14: 8000000000002005 R15: ffffea0005e5b680 FS: 0000000020002e00(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020000700 CR3: 00000001862ce000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: try_to_release_page+0x1bd/0x210 mm/filemap.c:3664 shrink_page_list+0x240a/0x3c60 mm/vmscan.c:1453 shrink_inactive_list+0x38f/0xcd0 mm/vmscan.c:2016 shrink_list mm/vmscan.c:2240 [inline] shrink_lruvec+0x499/0xa50 mm/vmscan.c:2558 shrink_node_memcgs+0x44f/0x9a0 mm/vmscan.c:2749 shrink_node+0xce1/0x1b30 mm/vmscan.c:2866 shrink_zones+0x48d/0x960 mm/vmscan.c:3069 do_try_to_free_pages+0x217/0xa50 mm/vmscan.c:3125 try_to_free_mem_cgroup_pages+0x3a2/0x840 mm/vmscan.c:3443 try_charge+0x4a5/0x1020 mm/memcontrol.c:2774 __mem_cgroup_charge+0x12d/0x720 mm/memcontrol.c:6847 mem_cgroup_charge include/linux/memcontrol.h:456 [inline] __add_to_page_cache_locked+0x2bc/0xb30 mm/filemap.c:854 add_to_page_cache_lru+0x116/0x2b0 mm/filemap.c:948 pagecache_get_page+0x62c/0x850 mm/filemap.c:1859 grab_cache_page_write_begin+0x5c/0xa0 mm/filemap.c:3418 ext4_da_write_begin+0x5c2/0xf10 fs/ext4/inode.c:3056 generic_perform_write+0x309/0x5b0 mm/filemap.c:3468 ext4_buffered_write_iter+0x47c/0x610 fs/ext4/file.c:272 ext4_file_write_iter+0x192/0x1c70 fs/ext4/file.c:689 __kernel_write+0x5ad/0x9d0 fs/read_write.c:550 dump_emit fs/coredump.c:849 [inline] dump_user_range+0x25b/0x3b0 fs/coredump.c:902 elf_core_dump+0x3156/0x3cd0 fs/binfmt_elf.c:2287 do_coredump+0x1f7c/0x2dc0 fs/coredump.c:811 get_signal+0xdde/0x1440 kernel/signal.c:2774 arch_do_signal+0x8e/0x650 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop+0xa3/0xe0 kernel/entry/common.c:161 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] irqentry_exit_to_user_mode+0x56/0x80 kernel/entry/common.c:279 irqentry_exit+0x12/0x60 kernel/entry/common.c:367 exc_page_fault+0x7e/0x1b0 arch/x86/mm/fault.c:1521 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:571 RIP: 0033:0x7f48b24a40d1 Code: c4 28 c3 e8 f1 19 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 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f RSP: 002b:0000000020002d50 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 00007f48b25c3f80 RCX: 00007f48b24a40c9 RDX: 0000000020002d80 RSI: 0000000020002d50 RDI: 0000000000080040 RBP: 00007f48b24ffae9 R08: 0000000020002e00 R09: 0000000020002e00 R10: 0000000020002dc0 R11: 0000000000000202 R12: 0000000000000000 R13: 00007ffc0527908f R14: 00007f48b1217300 R15: 0000000000022000 Modules linked in: ---[ end trace 9ccbcfbc66930dab ]--- RIP: 0010:f2fs_release_page+0x328/0xb90 fs/f2fs/data.c:3775 Code: 00 4c 03 23 4c 89 e0 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 e7 e8 48 e3 92 ff bb d8 06 00 00 49 03 1c 24 48 89 d8 48 c1 e8 03 <42> 8a 04 28 84 c0 0f 85 c9 07 00 00 44 8b 33 bb 00 00 00 40 be 00 RSP: 0018:ffffc9000c70da00 EFLAGS: 00010206 RAX: 00000000000000db RBX: 00000000000006d8 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000282 RDI: 0000000000000001 RBP: ffffc9000c70da48 R08: ffffffff813f3353 R09: fffffbfff0d864f9 R10: fffffbfff0d864f9 R11: 1ffffffff0d864f8 R12: ffff88816c1063c8 R13: dffffc0000000000 R14: 8000000000002005 R15: ffffea0005e5b680 FS: 0000000020002e00(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f9cb3da9000 CR3: 00000001862ce000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 00 4c 03 23 add %cl,0x23(%rbx,%rax,1) 4: 4c 89 e0 mov %r12,%rax 7: 48 c1 e8 03 shr $0x3,%rax b: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) 10: 74 08 je 0x1a 12: 4c 89 e7 mov %r12,%rdi 15: e8 48 e3 92 ff callq 0xff92e362 1a: bb d8 06 00 00 mov $0x6d8,%ebx 1f: 49 03 1c 24 add (%r12),%rbx 23: 48 89 d8 mov %rbx,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 42 8a 04 28 mov (%rax,%r13,1),%al <-- trapping instruction 2e: 84 c0 test %al,%al 30: 0f 85 c9 07 00 00 jne 0x7ff 36: 44 8b 33 mov (%rbx),%r14d 39: bb 00 00 00 40 mov $0x40000000,%ebx 3e: be .byte 0xbe