================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline] BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline] BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline] BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline] BUG: KASAN: use-after-free in refcount_inc include/linux/refcount.h:267 [inline] BUG: KASAN: use-after-free in sock_hold include/net/sock.h:775 [inline] BUG: KASAN: use-after-free in nr_release+0x5c/0x430 net/netrom/af_netrom.c:520 Write of size 4 at addr ffff88807dc8e080 by task syz-executor.3/12953 CPU: 1 PID: 12953 Comm: syz-executor.3 Not tainted 6.2.0-rc3-syzkaller-00009-g5a41237ad1d4 #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/0x2d0 lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:306 print_report+0x107/0x220 mm/kasan/report.c:417 kasan_report+0x139/0x170 mm/kasan/report.c:517 kasan_check_range+0x2a7/0x2e0 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:102 [inline] atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline] __refcount_add include/linux/refcount.h:193 [inline] __refcount_inc include/linux/refcount.h:250 [inline] refcount_inc include/linux/refcount.h:267 [inline] sock_hold include/net/sock.h:775 [inline] nr_release+0x5c/0x430 net/netrom/af_netrom.c:520 __sock_release net/socket.c:650 [inline] sock_close+0xd7/0x260 net/socket.c:1365 __fput+0x3ba/0x880 fs/file_table.c:320 task_work_run+0x243/0x300 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x644/0x2150 kernel/exit.c:867 do_group_exit+0x1fd/0x2b0 kernel/exit.c:1012 get_signal+0x1755/0x1820 kernel/signal.c:2859 arch_do_signal_or_restart+0x8d/0x5f0 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x74/0x160 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x2e/0x60 kernel/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f36dce8c0c9 Code: Unable to access opcode bytes at 0x7f36dce8c09f. RSP: 002b:00007f36ddccc168 EFLAGS: 00000246 ORIG_RAX: 0000000000000110 RAX: fffffffffffffffc RBX: 00007f36dcfabf80 RCX: 00007f36dce8c0c9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000040000000 RBP: 00007f36dcee7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff74b8e68f R14: 00007f36ddccc300 R15: 0000000000022000 Allocated by task 12953: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:380 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:968 [inline] __kmalloc+0xaf/0x190 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] sk_prot_alloc+0xde/0x200 net/core/sock.c:2038 sk_alloc+0x34/0x360 net/core/sock.c:2091 nr_create+0x9d/0x500 net/netrom/af_netrom.c:433 __sock_create+0x3fd/0x850 net/socket.c:1515 sock_create net/socket.c:1566 [inline] __sys_socket_create net/socket.c:1603 [inline] __sys_socket+0x137/0x3a0 net/socket.c:1636 __do_sys_socket net/socket.c:1649 [inline] __se_sys_socket net/socket.c:1647 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1647 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 36: 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:518 ____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:1781 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1807 slab_free mm/slub.c:3787 [inline] __kmem_cache_free+0x71/0x110 mm/slub.c:3800 sk_prot_free net/core/sock.c:2074 [inline] __sk_destruct+0x48c/0x5e0 net/core/sock.c:2166 call_timer_fn+0xf5/0x210 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x775/0x990 kernel/time/timer.c:2022 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:2035 __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:488 __call_rcu_common kernel/rcu/tree.c:2755 [inline] call_rcu+0x163/0xab0 kernel/rcu/tree.c:2868 netlink_release+0x13e1/0x1820 net/netlink/af_netlink.c:826 __sock_release net/socket.c:650 [inline] sock_close+0xd7/0x260 net/socket.c:1365 __fput+0x3ba/0x880 fs/file_table.c:320 task_work_run+0x243/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x134/0x160 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x2e/0x60 kernel/entry/common.c:296 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:488 __call_rcu_common kernel/rcu/tree.c:2755 [inline] call_rcu+0x163/0xab0 kernel/rcu/tree.c:2868 wg_noise_keypair_put drivers/net/wireguard/noise.c:139 [inline] add_new_keypair drivers/net/wireguard/noise.c:248 [inline] wg_noise_handshake_begin_session+0x793/0xcd0 drivers/net/wireguard/noise.c:845 wg_packet_send_handshake_response+0x117/0x2c0 drivers/net/wireguard/send.c:96 wg_receive_handshake_packet+0x3b2/0xa00 drivers/net/wireguard/receive.c:154 wg_packet_handshake_receive_worker+0x243/0x4f0 drivers/net/wireguard/receive.c:213 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:308 The buggy address belongs to the object at ffff88807dc8e000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 128 bytes inside of 2048-byte region [ffff88807dc8e000, ffff88807dc8e800) The buggy address belongs to the physical page: page:ffffea0001f72200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7dc88 head:ffffea0001f72200 order:3 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0 anon flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffff888012842000 0000000000000000 dead000000000001 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 0xd28c0(GFP_NOWAIT|__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5098, tgid 5098 (syz-executor.4), ts 150760368273, free_ts 150758084126 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549 alloc_slab_page+0xbd/0x190 mm/slub.c:1851 allocate_slab+0x5e/0x3c0 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0x7f4/0xeb0 mm/slub.c:3193 __slab_alloc mm/slub.c:3292 [inline] __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0x25b/0x340 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc_node_track_caller+0x9c/0x190 mm/slab_common.c:988 kmalloc_reserve net/core/skbuff.c:492 [inline] pskb_expand_head+0x191/0x11c0 net/core/skbuff.c:1899 netlink_trim+0x17f/0x210 net/netlink/af_netlink.c:1312 netlink_broadcast+0x64/0x1170 net/netlink/af_netlink.c:1508 nlmsg_multicast include/net/netlink.h:1082 [inline] nlmsg_notify+0xfa/0x1c0 net/netlink/af_netlink.c:2607 register_netdevice+0x16fe/0x1a30 net/core/dev.c:10092 __ip_tunnel_create+0x2af/0x370 net/ipv4/ip_tunnel.c:267 ip_tunnel_init_net+0x219/0x700 net/ipv4/ip_tunnel.c:1073 ops_init+0x353/0x5d0 net/core/net_namespace.c:135 setup_net+0x60b/0xd80 net/core/net_namespace.c:333 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x751/0x780 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page+0x19/0x4c0 mm/page_alloc.c:3464 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:761 [inline] slab_alloc_node mm/slub.c:3452 [inline] __kmem_cache_alloc_node+0x1e0/0x340 mm/slub.c:3491 kmalloc_trace+0x26/0x60 mm/slab_common.c:1062 kmalloc include/linux/slab.h:580 [inline] kzalloc include/linux/slab.h:720 [inline] kset_create lib/kobject.c:944 [inline] kset_create_and_add+0x57/0x160 lib/kobject.c:987 register_queue_kobjects net/core/net-sysfs.c:1766 [inline] netdev_register_kobject+0x1a2/0x310 net/core/net-sysfs.c:2019 register_netdevice+0x136c/0x1a30 net/core/dev.c:10045 __ip_tunnel_create+0x2af/0x370 net/ipv4/ip_tunnel.c:267 ip_tunnel_init_net+0x219/0x700 net/ipv4/ip_tunnel.c:1073 ops_init+0x353/0x5d0 net/core/net_namespace.c:135 setup_net+0x60b/0xd80 net/core/net_namespace.c:333 copy_net_ns+0x34c/0x5a0 net/core/net_namespace.c:483 create_new_namespaces+0x4db/0x8e0 kernel/nsproxy.c:110 Memory state around the buggy address: ffff88807dc8df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807dc8e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807dc8e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807dc8e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807dc8e180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================