================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: use-after-free in atomic64_try_cmpxchg_acquire include/asm-generic/atomic-instrumented.h:1515 [inline] BUG: KASAN: use-after-free in atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:443 [inline] BUG: KASAN: use-after-free in __down_read_trylock+0xb6/0x260 kernel/locking/rwsem.c:1404 Write of size 8 at addr ffff88810a8bf070 by task kworker/u4:5/2798 CPU: 0 PID: 2798 Comm: kworker/u4:5 Not tainted 5.10.160-syzkaller-01321-g003c389455eb #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: writeback wb_workfn (flush-7:2) 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 check_region_inline mm/kasan/generic.c:135 [inline] kasan_check_range+0x2aa/0x2e0 mm/kasan/generic.c:186 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] atomic64_try_cmpxchg_acquire include/asm-generic/atomic-instrumented.h:1515 [inline] atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:443 [inline] __down_read_trylock+0xb6/0x260 kernel/locking/rwsem.c:1404 down_read_trylock+0x9/0x10 kernel/locking/rwsem.c:1573 trylock_super+0x1f/0xf0 fs/super.c:418 __writeback_inodes_wb fs/fs-writeback.c:1792 [inline] wb_writeback+0x4da/0xc20 fs/fs-writeback.c:1907 wb_check_old_data_flush fs/fs-writeback.c:2009 [inline] wb_do_writeback+0x995/0xbd0 fs/fs-writeback.c:2062 wb_workfn+0xf8/0x3f0 fs/fs-writeback.c:2091 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 Allocated by task 11455: 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] kmem_cache_alloc_trace+0x1dd/0x330 mm/slub.c:2983 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] keypair_create drivers/net/wireguard/noise.c:100 [inline] wg_noise_handshake_begin_session+0xc7/0x750 drivers/net/wireguard/noise.c:827 wg_packet_send_handshake_response+0x118/0x1f0 drivers/net/wireguard/send.c:96 wg_receive_handshake_packet drivers/net/wireguard/receive.c:161 [inline] wg_packet_handshake_receive_worker+0x55a/0x950 drivers/net/wireguard/receive.c:220 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 Freed by task 13238: 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 kfree_sensitive+0x6d/0x80 mm/slab_common.c:1169 keypair_free_rcu+0x1c/0x20 drivers/net/wireguard/noise.c:114 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 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 keypair_free_kref drivers/net/wireguard/noise.c:128 [inline] kref_put include/linux/kref.h:65 [inline] wg_noise_keypair_put+0xe6/0x1a0 drivers/net/wireguard/noise.c:139 wg_noise_keypairs_clear+0xeb/0x110 drivers/net/wireguard/noise.c:174 wg_stop+0x9f/0x5e0 drivers/net/wireguard/device.c:109 __dev_close_many+0x2cd/0x3b0 net/core/dev.c:1626 __dev_close net/core/dev.c:1638 [inline] __dev_change_flags+0x2fd/0x6d0 net/core/dev.c:8495 dev_change_flags+0x8a/0x190 net/core/dev.c:8568 do_setlink+0xc3e/0x3b50 net/core/rtnetlink.c:2709 rtnl_group_changelink net/core/rtnetlink.c:3228 [inline] __rtnl_newlink net/core/rtnetlink.c:3384 [inline] rtnl_newlink+0x1152/0x1ff0 net/core/rtnetlink.c:3494 rtnetlink_rcv_msg+0x95a/0xc60 net/core/rtnetlink.c:5571 netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2515 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5589 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline] netlink_unicast+0x91a/0xb10 net/netlink/af_netlink.c:1339 netlink_sendmsg+0xa40/0xd00 net/netlink/af_netlink.c:1934 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg net/socket.c:672 [inline] ____sys_sendmsg+0x597/0x8e0 net/socket.c:2343 ___sys_sendmsg net/socket.c:2397 [inline] __sys_sendmsg+0x37b/0x460 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x7f/0x90 net/socket.c:2437 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 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 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 The buggy address belongs to the object at ffff88810a8bf000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 112 bytes inside of 2048-byte region [ffff88810a8bf000, ffff88810a8bf800) The buggy address belongs to the page: page:ffffea00042a2e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10a8b8 head:ffffea00042a2e00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 0000000000000000 0000000100000001 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 1777482244, free_ts 0 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_track_caller+0x23e/0x350 mm/slub.c:4545 __kmalloc_reserve net/core/skbuff.c:143 [inline] __alloc_skb+0xbe/0x580 net/core/skbuff.c:211 alloc_skb include/linux/skbuff.h:1116 [inline] nlmsg_new include/net/netlink.h:953 [inline] rtmsg_ifinfo_build_skb+0x7f/0x180 net/core/rtnetlink.c:3808 rtmsg_ifinfo_event net/core/rtnetlink.c:3844 [inline] rtmsg_ifinfo+0x77/0x120 net/core/rtnetlink.c:3853 register_netdevice+0x151d/0x1790 net/core/dev.c:10064 dummy_init_one+0x75/0xb7 drivers/net/dummy.c:170 dummy_init_module+0x68/0xe5 drivers/net/dummy.c:191 do_one_initcall+0x1b5/0x610 init/main.c:1206 do_initcall_level+0x192/0x2f0 init/main.c:1279 do_initcalls+0x50/0x94 init/main.c:1295 do_basic_setup+0x88/0x91 init/main.c:1315 page_owner free stack trace missing Memory state around the buggy address: ffff88810a8bef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88810a8bef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88810a8bf000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88810a8bf080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810a8bf100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================