================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline] BUG: KASAN: slab-use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline] BUG: KASAN: slab-use-after-free in get_pages fs/f2fs/f2fs.h:2718 [inline] BUG: KASAN: slab-use-after-free in f2fs_write_end_io+0x9b9/0xb60 fs/f2fs/data.c:364 Read of size 4 at addr ffff888034e8d170 by task kworker/u4:13/3006 CPU: 0 UID: 0 PID: 3006 Comm: kworker/u4:13 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: loop0 loop_workfn Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:200 instrument_atomic_read include/linux/instrumented.h:68 [inline] atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline] get_pages fs/f2fs/f2fs.h:2718 [inline] f2fs_write_end_io+0x9b9/0xb60 fs/f2fs/data.c:364 blk_update_request+0x57e/0xe60 block/blk-mq.c:1007 blk_mq_end_request+0x3e/0x70 block/blk-mq.c:1169 lo_rw_aio_complete drivers/block/loop.c:337 [inline] lo_rw_aio+0xcd1/0xef0 drivers/block/loop.c:410 do_req_filebacked drivers/block/loop.c:-1 [inline] loop_handle_cmd drivers/block/loop.c:1926 [inline] loop_process_work+0x8fe/0x10b0 drivers/block/loop.c:1961 process_one_work kernel/workqueue.c:3257 [inline] process_scheduled_works+0xad1/0x1770 kernel/workqueue.c:3340 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3421 kthread+0x711/0x8a0 kernel/kthread.c:463 ret_from_fork+0x510/0xa50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 Allocated by task 5340: kasan_save_stack mm/kasan/common.c:56 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:397 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:414 kasan_kmalloc include/linux/kasan.h:262 [inline] __kmalloc_cache_noprof+0x3e2/0x700 mm/slub.c:5776 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] f2fs_fill_super+0x8c/0x6ec0 fs/f2fs/super.c:4895 get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1691 vfs_get_tree+0x92/0x2a0 fs/super.c:1751 fc_mount fs/namespace.c:1199 [inline] do_new_mount_fc fs/namespace.c:3636 [inline] do_new_mount+0x302/0xa10 fs/namespace.c:3712 do_mount fs/namespace.c:4035 [inline] __do_sys_mount fs/namespace.c:4224 [inline] __se_sys_mount+0x313/0x410 fs/namespace.c:4201 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 5340: kasan_save_stack mm/kasan/common.c:56 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:77 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2540 [inline] slab_free mm/slub.c:6670 [inline] kfree+0x1c0/0x660 mm/slub.c:6878 kill_f2fs_super+0x5b6/0x6c0 fs/f2fs/super.c:5458 deactivate_locked_super+0xbc/0x130 fs/super.c:474 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1318 task_work_run+0x1d4/0x260 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x694/0x22f0 kernel/exit.c:971 do_group_exit+0x21c/0x2d0 kernel/exit.c:1112 get_signal+0x1285/0x1340 kernel/signal.c:3034 arch_do_signal_or_restart+0x9a/0x7a0 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:41 [inline] exit_to_user_mode_loop+0x87/0x4e0 kernel/entry/common.c:75 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline] do_syscall_64+0x2b7/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Last potentially related work creation: kasan_save_stack+0x3e/0x60 mm/kasan/common.c:56 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:556 insert_work+0x3d/0x330 kernel/workqueue.c:2180 __queue_work+0xcd0/0xf90 kernel/workqueue.c:2335 queue_work_on+0x106/0x1c0 kernel/workqueue.c:2386 queue_work include/linux/workqueue.h:669 [inline] schedule_work include/linux/workqueue.h:730 [inline] f2fs_handle_critical_error+0x255/0x540 fs/f2fs/super.c:4624 f2fs_write_end_io+0x886/0xb60 fs/f2fs/data.c:351 __submit_merged_bio+0x256/0x660 fs/f2fs/data.c:540 __f2fs_submit_merged_write fs/f2fs/data.c:635 [inline] __submit_merged_write_cond+0x471/0x530 fs/f2fs/data.c:657 f2fs_sync_node_pages+0x1479/0x15e0 fs/f2fs/node.c:2166 block_operations fs/f2fs/checkpoint.c:1276 [inline] f2fs_write_checkpoint+0xdd5/0x2430 fs/f2fs/checkpoint.c:1678 kill_f2fs_super+0x2d2/0x6c0 fs/f2fs/super.c:5448 deactivate_locked_super+0xbc/0x130 fs/super.c:474 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1318 task_work_run+0x1d4/0x260 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x694/0x22f0 kernel/exit.c:971 do_group_exit+0x21c/0x2d0 kernel/exit.c:1112 get_signal+0x1285/0x1340 kernel/signal.c:3034 arch_do_signal_or_restart+0x9a/0x7a0 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:41 [inline] exit_to_user_mode_loop+0x87/0x4e0 kernel/entry/common.c:75 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline] do_syscall_64+0x2b7/0xf80 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Second to last potentially related work creation: kasan_save_stack+0x3e/0x60 mm/kasan/common.c:56 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:556 insert_work+0x3d/0x330 kernel/workqueue.c:2180 __queue_work+0xcd0/0xf90 kernel/workqueue.c:2335 queue_work_on+0x106/0x1c0 kernel/workqueue.c:2386 sanity_check_node_footer fs/f2fs/node.c:1536 [inline] __get_node_folio+0xcaf/0x14f0 fs/f2fs/node.c:1581 do_read_inode fs/f2fs/inode.c:425 [inline] f2fs_iget+0x77c/0x5640 fs/f2fs/inode.c:596 f2fs_nfs_get_inode+0x76/0x110 fs/f2fs/super.c:3723 generic_fh_to_dentry+0x9f/0xf0 fs/libfs.c:1498 exportfs_decode_fh_raw+0x178/0x6e0 fs/exportfs/expfs.c:456 do_handle_to_path+0xa4/0x1a0 fs/fhandle.c:276 handle_to_path fs/fhandle.c:400 [inline] do_handle_open+0x6a1/0x930 fs/fhandle.c:424 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888034e8c000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 4464 bytes inside of freed 8192-byte region [ffff888034e8c000, ffff888034e8e000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x34e88 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801a442280 ffffea0001040e00 0000000000000002 raw: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801a442280 ffffea0001040e00 0000000000000002 head: 0000000000000000 0000000080020002 00000000f5000000 0000000000000000 head: 04fff00000000003 ffffea0000d3a201 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5313, tgid 5313 (sh), ts 71789776197, free_ts 61194130240 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x234/0x290 mm/page_alloc.c:1846 prep_new_page mm/page_alloc.c:1854 [inline] get_page_from_freelist+0x24e0/0x2580 mm/page_alloc.c:3915 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5210 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2486 alloc_slab_page mm/slub.c:3075 [inline] allocate_slab+0x86/0x3b0 mm/slub.c:3248 new_slab mm/slub.c:3302 [inline] ___slab_alloc+0xe53/0x1820 mm/slub.c:4656 __slab_alloc+0x65/0x100 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] __kmalloc_cache_noprof+0x41e/0x700 mm/slub.c:5771 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] tomoyo_print_bprm security/tomoyo/audit.c:26 [inline] tomoyo_init_log+0x111f/0x1f70 security/tomoyo/audit.c:264 tomoyo_supervisor+0x340/0x1480 security/tomoyo/common.c:2198 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x149/0x1e0 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0x15ce/0x1aa0 security/tomoyo/domain.c:888 tomoyo_bprm_check_security+0x11c/0x180 security/tomoyo/tomoyo.c:102 security_bprm_check+0x89/0x270 security/security.c:794 search_binary_handler fs/exec.c:1659 [inline] exec_binprm fs/exec.c:1701 [inline] bprm_execve+0x887/0x1400 fs/exec.c:1753 do_execveat_common+0x510/0x6a0 fs/exec.c:1859 page last free pid 5256 tgid 5256 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] __free_frozen_pages+0xbc8/0xd30 mm/page_alloc.c:2943 skb_release_data+0x62d/0x7c0 net/core/skbuff.c:1107 skb_release_all net/core/skbuff.c:1182 [inline] kfree_skb_add_bulk net/core/skbuff.c:1255 [inline] kfree_skb_list_reason+0x25d/0x460 net/core/skbuff.c:1277 skb_release_data+0x61e/0x7c0 net/core/skbuff.c:1105 skb_release_all net/core/skbuff.c:1182 [inline] __napi_kfree_skb net/core/skbuff.c:1474 [inline] kfree_skb_napi_cache net/core/skbuff.c:7215 [inline] skb_attempt_defer_free+0x4e3/0x6d0 net/core/skbuff.c:7238 tcp_eat_recv_skb net/ipv4/tcp.c:1583 [inline] tcp_recvmsg_locked+0x2479/0x3670 net/ipv4/tcp.c:2883 tcp_recvmsg+0x210/0x810 net/ipv4/tcp.c:2929 inet_recvmsg+0x147/0x250 net/ipv4/af_inet.c:891 sock_recvmsg_nosec net/socket.c:1078 [inline] sock_recvmsg+0x1a8/0x270 net/socket.c:1100 sock_read_iter+0x231/0x2f0 net/socket.c:1170 new_sync_read fs/read_write.c:491 [inline] vfs_read+0x55a/0xa30 fs/read_write.c:572 ksys_read+0x145/0x250 fs/read_write.c:715 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xec/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888034e8d000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888034e8d080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888034e8d100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888034e8d180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888034e8d200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================