================================================================== 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 ffff88811802f3c8 by task syz-executor.1/12694 CPU: 1 PID: 12694 Comm: syz-executor.1 Not tainted 5.10.161-syzkaller-00019-g416c4356f372 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 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 reclaim_high+0x204/0x290 mm/memcontrol.c:2473 mem_cgroup_handle_over_high+0x145/0x2b0 mm/memcontrol.c:2657 tracehook_notify_resume include/linux/tracehook.h:197 [inline] exit_to_user_mode_loop+0x25/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 ret_from_fork+0x15/0x30 arch/x86/entry/entry_64.S:292 RIP: 0033:0x7f5d71eecdfb Code: Unable to access opcode bytes at RIP 0x7f5d71eecdd1. RSP: 002b:00007ffe76eb2890 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f5d71eecdfb RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011 RBP: 0000000000000000 R08: 0000000000000000 R09: 00005555566d0400 R10: 00005555566d06d0 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000001 R15: 00007ffe76eb2970 Allocated by task 12481: 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 unshare_fd kernel/fork.c:2953 [inline] unshare_files+0x11e/0x2c0 kernel/fork.c:3102 bprm_execve+0xae/0x9f0 fs/exec.c:1798 do_execveat_common+0x905/0xa90 fs/exec.c:1942 do_execve fs/exec.c:2012 [inline] __do_sys_execve fs/exec.c:2088 [inline] __se_sys_execve fs/exec.c:2083 [inline] __x64_sys_execve+0x92/0xb0 fs/exec.c:2083 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Freed by task 12481: 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 reset_files_struct+0x88/0xa0 fs/file.c:476 bprm_execve+0x160/0x9f0 fs/exec.c:1861 do_execveat_common+0x905/0xa90 fs/exec.c:1942 do_execve fs/exec.c:2012 [inline] __do_sys_execve fs/exec.c:2088 [inline] __se_sys_execve fs/exec.c:2083 [inline] __x64_sys_execve+0x92/0xb0 fs/exec.c:2083 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 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 ffff88811802f000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 968 bytes inside of 2048-byte region [ffff88811802f000, ffff88811802f800) The buggy address belongs to the page: page:ffffea0004600a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x118028 head:ffffea0004600a00 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 567, ts 307436724122, free_ts 307388592562 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] __kmalloc+0x24f/0x360 mm/slub.c:4038 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:664 [inline] __register_sysctl_table+0xee/0x1280 fs/proc/proc_sysctl.c:1314 register_net_sysctl+0x2c/0x40 net/sysctl_net.c:121 __devinet_sysctl_register+0x1e7/0x2b0 net/ipv4/devinet.c:2572 devinet_sysctl_register+0x169/0x1e0 net/ipv4/devinet.c:2612 inetdev_init+0x254/0x460 net/ipv4/devinet.c:276 inetdev_event+0x202/0x1090 net/ipv4/devinet.c:1531 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x9e/0x110 kernel/notifier.c:410 call_netdevice_notifiers_info net/core/dev.c:2054 [inline] call_netdevice_notifiers_extack net/core/dev.c:2066 [inline] call_netdevice_notifiers+0x14e/0x1d0 net/core/dev.c:2080 register_netdevice+0x1404/0x1790 net/core/dev.c:10050 ip6_tnl_create2+0xc6/0x380 net/ipv6/ip6_tunnel.c:290 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_pages_ok+0x7f8/0x830 mm/page_alloc.c:1612 free_the_page mm/page_alloc.c:5221 [inline] __free_pages+0x383/0x570 mm/page_alloc.c:5228 __free_slab+0xd3/0x190 mm/slub.c:1903 free_slab mm/slub.c:1918 [inline] discard_slab+0x29/0x40 mm/slub.c:1924 __slab_free+0x31d/0x3a0 mm/slub.c:3140 do_slab_free mm/slub.c:3200 [inline] ___cache_free+0x11f/0x140 mm/slub.c:3219 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146 qlist_free_all+0x4c/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:438 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook include/../mm/slab.h:583 [inline] slab_alloc_node mm/slub.c:2956 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc+0x16c/0x300 mm/slub.c:2969 vm_area_alloc+0x24/0x160 kernel/fork.c:354 mmap_region+0xb03/0x1d20 mm/mmap.c:1847 do_mmap+0x7d9/0xe20 mm/mmap.c:1649 vm_mmap_pgoff+0x245/0x370 mm/util.c:543 ksys_mmap_pgoff+0xf8/0x1f0 mm/mmap.c:1700 Memory state around the buggy address: ffff88811802f280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811802f300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88811802f380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811802f400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811802f480: 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: 0 PID: 12694 Comm: syz-executor.1 Tainted: G B 5.10.161-syzkaller-00019-g416c4356f372 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 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:ffffc9000654f020 EFLAGS: 00010206 RAX: 00000000000000db RBX: 00000000000006d8 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000286 RDI: 0000000000000001 RBP: ffffc9000654f068 R08: ffffffff813f3353 R09: fffffbfff0d864f9 R10: fffffbfff0d864f9 R11: 1ffffffff0d864f8 R12: ffff88811802f3c8 R13: dffffc0000000000 R14: 8000000000002005 R15: ffffea00045a2640 FS: 00005555566d0400(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc490e7708 CR3: 0000000111981000 CR4: 00000000003506b0 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 reclaim_high+0x204/0x290 mm/memcontrol.c:2473 mem_cgroup_handle_over_high+0x145/0x2b0 mm/memcontrol.c:2657 tracehook_notify_resume include/linux/tracehook.h:197 [inline] exit_to_user_mode_loop+0x25/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 ret_from_fork+0x15/0x30 arch/x86/entry/entry_64.S:292 RIP: 0033:0x7f5d71eecdfb Code: Unable to access opcode bytes at RIP 0x7f5d71eecdd1. RSP: 002b:00007ffe76eb2890 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f5d71eecdfb RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011 RBP: 0000000000000000 R08: 0000000000000000 R09: 00005555566d0400 R10: 00005555566d06d0 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000001 R15: 00007ffe76eb2970 Modules linked in: ---[ end trace de63f278138d6a1a ]--- 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:ffffc9000654f020 EFLAGS: 00010206 RAX: 00000000000000db RBX: 00000000000006d8 RCX: 0000000000000001 RDX: 0000000000000000 RSI: 0000000000000286 RDI: 0000000000000001 RBP: ffffc9000654f068 R08: ffffffff813f3353 R09: fffffbfff0d864f9 R10: fffffbfff0d864f9 R11: 1ffffffff0d864f8 R12: ffff88811802f3c8 R13: dffffc0000000000 R14: 8000000000002005 R15: ffffea00045a2640 FS: 00005555566d0400(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffe24192c48 CR3: 0000000111981000 CR4: 00000000003506a0 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