================================================================== BUG: KASAN: use-after-free in __wake_up_common+0x637/0x650 kernel/sched/wait.c:100 Read of size 8 at addr ffff88801cf86f30 by task syz-executor.0/29863 CPU: 1 PID: 29863 Comm: syz-executor.0 Not tainted 5.19.0-rc4-next-20220628-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 kasan_report+0xbe/0x1f0 mm/kasan/report.c:495 __wake_up_common+0x637/0x650 kernel/sched/wait.c:100 __wake_up_common_lock+0xd0/0x130 kernel/sched/wait.c:137 pty_close+0x11b/0x4f0 drivers/tty/pty.c:59 tty_release+0x45e/0x1200 drivers/tty/tty_io.c:1758 __fput+0x277/0x9d0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xaf1/0x29f0 kernel/exit.c:795 do_group_exit+0xd2/0x2f0 kernel/exit.c:925 get_signal+0x2542/0x2600 kernel/signal.c:2857 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:166 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7f915e2891f9 Code: Unable to access opcode bytes at RIP 0x7f915e2891cf. RSP: 002b:00007f915f478218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 00007f915e39c038 RCX: 00007f915e2891f9 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f915e39c038 RBP: 00007f915e39c030 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f915e39c03c R13: 00007ffc725aa04f R14: 00007f915f478300 R15: 0000000000022000 Allocated by task 29863: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:600 [inline] __io_queue_proc+0x2dc/0x950 io_uring/poll.c:429 poll_wait include/linux/poll.h:49 [inline] n_tty_poll+0xb4/0x8a0 drivers/tty/n_tty.c:2425 tty_poll+0x139/0x1b0 drivers/tty/tty_io.c:2212 vfs_poll include/linux/poll.h:88 [inline] __io_arm_poll_handler+0x488/0x1060 io_uring/poll.c:511 io_arm_poll_handler+0x5c6/0xce0 io_uring/poll.c:638 io_queue_async+0xc1/0x3e0 io_uring/io_uring.c:1753 io_queue_sqe io_uring/io_uring.c:1787 [inline] io_submit_sqe io_uring/io_uring.c:2036 [inline] io_submit_sqes+0x15fc/0x1ec0 io_uring/io_uring.c:2147 __do_sys_io_uring_enter+0xb85/0x1eb0 io_uring/io_uring.c:3087 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 29863: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3534 [inline] kfree+0xe2/0x4d0 mm/slub.c:4562 io_clean_op+0x1b1/0xa40 io_uring/io_uring.c:1555 io_dismantle_req io_uring/io_uring.c:930 [inline] __io_req_complete_put+0x649/0x8b0 io_uring/io_uring.c:801 __io_req_complete_post io_uring/io_uring.c:812 [inline] io_req_complete_post+0x98/0x260 io_uring/io_uring.c:820 handle_tw_list+0xa8/0x420 io_uring/io_uring.c:1009 tctx_task_work+0xc4/0x420 io_uring/io_uring.c:1056 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xaf1/0x29f0 kernel/exit.c:795 do_group_exit+0xd2/0x2f0 kernel/exit.c:925 get_signal+0x2542/0x2600 kernel/signal.c:2857 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:166 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x940 kernel/rcu/tree.c:3323 __netdev_adjacent_dev_remove+0x327/0x680 net/core/dev.c:7558 __netdev_adjacent_dev_unlink_lists net/core/dev.c:7591 [inline] __netdev_adjacent_dev_unlink_neighbour net/core/dev.c:7607 [inline] __netdev_upper_dev_unlink+0x12b/0x400 net/core/dev.c:7757 netdev_upper_dev_unlink+0x7c/0xb0 net/core/dev.c:7786 unregister_vlan_dev+0x29a/0x550 net/8021q/vlan.c:113 rtnl_newlink_create net/core/rtnetlink.c:3393 [inline] __rtnl_newlink+0x1434/0x17e0 net/core/rtnetlink.c:3580 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3593 rtnetlink_rcv_msg+0x43a/0xc90 net/core/rtnetlink.c:6089 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 ____sys_sendmsg+0x6eb/0x810 net/socket.c:2485 ___sys_sendmsg+0xf3/0x170 net/socket.c:2539 __sys_sendmsg net/socket.c:2568 [inline] __do_sys_sendmsg net/socket.c:2577 [inline] __se_sys_sendmsg net/socket.c:2575 [inline] __x64_sys_sendmsg+0x132/0x220 net/socket.c:2575 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:2793 mpls_dev_notify+0x552/0x8a0 net/mpls/af_mpls.c:1655 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945 call_netdevice_notifiers_extack net/core/dev.c:1983 [inline] call_netdevice_notifiers net/core/dev.c:1997 [inline] unregister_netdevice_many+0x943/0x18b0 net/core/dev.c:10857 default_device_exit_batch+0x449/0x590 net/core/dev.c:11351 ops_exit_list+0x125/0x170 net/core/net_namespace.c:168 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:595 process_one_work+0x991/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:302 The buggy address belongs to the object at ffff88801cf86f00 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 48 bytes inside of 64-byte region [ffff88801cf86f00, ffff88801cf86f40) The buggy address belongs to the physical page: page:ffffea000073e180 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801cf86f80 pfn:0x1cf86 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000093a588 ffffea0001eec5c8 ffff888011841640 raw: ffff88801cf86f80 000000000020001f 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 2969, tgid 2969 (udevd), ts 358557209920, free_ts 358522795118 prep_new_page mm/page_alloc.c:2535 [inline] get_page_from_freelist+0x210d/0x3a30 mm/page_alloc.c:4282 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5506 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2280 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x27e/0x3d0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x89d/0xef0 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] __kmalloc+0x3a2/0x450 mm/slub.c:4420 kmalloc include/linux/slab.h:605 [inline] kzalloc include/linux/slab.h:733 [inline] tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline] tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x186/0x620 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x272/0x380 security/tomoyo/file.c:771 tomoyo_file_open security/tomoyo/tomoyo.c:320 [inline] tomoyo_file_open+0x9d/0xc0 security/tomoyo/tomoyo.c:315 security_file_open+0x45/0xb0 security/security.c:1646 do_dentry_open+0x349/0x11f0 fs/open.c:865 do_open fs/namei.c:3520 [inline] path_openat+0x1c71/0x2930 fs/namei.c:3653 do_filp_open+0x1aa/0x400 fs/namei.c:3680 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1453 [inline] free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1503 free_unref_page_prepare mm/page_alloc.c:3383 [inline] free_unref_page_list+0x16f/0xb90 mm/page_alloc.c:3525 release_pages+0xbe8/0x1810 mm/swap.c:1017 tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:58 tlb_flush_mmu_free mm/mmu_gather.c:255 [inline] tlb_flush_mmu mm/mmu_gather.c:262 [inline] tlb_finish_mmu+0x147/0x7e0 mm/mmu_gather.c:353 exit_mmap+0x1fe/0x720 mm/mmap.c:3212 __mmput+0x128/0x4c0 kernel/fork.c:1180 mmput+0x5c/0x70 kernel/fork.c:1201 exit_mm kernel/exit.c:510 [inline] do_exit+0xa09/0x29f0 kernel/exit.c:782 do_group_exit+0xd2/0x2f0 kernel/exit.c:925 get_signal+0x2542/0x2600 kernel/signal.c:2857 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:166 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Memory state around the buggy address: ffff88801cf86e00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff88801cf86e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88801cf86f00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88801cf86f80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88801cf87000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================