================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline] BUG: KASAN: slab-use-after-free in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline] BUG: KASAN: slab-use-after-free in __refcount_add include/linux/refcount.h:193 [inline] BUG: KASAN: slab-use-after-free in __refcount_inc include/linux/refcount.h:250 [inline] BUG: KASAN: slab-use-after-free in refcount_inc include/linux/refcount.h:267 [inline] BUG: KASAN: slab-use-after-free in sock_hold include/net/sock.h:775 [inline] BUG: KASAN: slab-use-after-free in nr_release+0x66/0x460 net/netrom/af_netrom.c:525 Write of size 4 at addr ffff8880a1b10080 by task syz-executor.5/5402 CPU: 1 PID: 5402 Comm: syz-executor.5 Not tainted 6.4.0-rc2-syzkaller-00555-g8a5ad2ea6b87 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/16/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:572 check_region_inline mm/kasan/generic.c:181 [inline] kasan_check_range+0x141/0x190 mm/kasan/generic.c:187 instrument_atomic_read_write include/linux/instrumented.h:96 [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+0x66/0x460 net/netrom/af_netrom.c:525 __sock_release+0xcd/0x290 net/socket.c:653 sock_close+0x1c/0x20 net/socket.c:1397 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f816323e01b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffc051ab6f0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000005 RCX: 00007f816323e01b RDX: 0000001b2df20000 RSI: 00007f8161dff000 RDI: 0000000000000004 RBP: 00007f81633ad980 R08: 0000000000000000 R09: 0000000036638d32 R10: 00007ffc051df090 R11: 0000000000000293 R12: 00000000001fdd0a R13: 00007ffc051ab7f0 R14: 00007f81633ac2c0 R15: 0000000000000032 Allocated by task 5409: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] ____kasan_kmalloc mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc+0x5e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] sk_prot_alloc+0x140/0x290 net/core/sock.c:2035 sk_alloc+0x3a/0x7f0 net/core/sock.c:2088 nr_create+0xb6/0x5f0 net/netrom/af_netrom.c:438 __sock_create+0x380/0x850 net/socket.c:1547 sock_create net/socket.c:1598 [inline] __sys_socket_create net/socket.c:1635 [inline] __sys_socket_create net/socket.c:1620 [inline] __sys_socket+0x133/0x250 net/socket.c:1663 __do_sys_socket net/socket.c:1676 [inline] __se_sys_socket net/socket.c:1674 [inline] __x64_sys_socket+0x73/0xb0 net/socket.c:1674 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5402: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0xaf/0x2d0 mm/slub.c:3799 sk_prot_free net/core/sock.c:2071 [inline] __sk_destruct+0x5fc/0x770 net/core/sock.c:2163 sk_destruct net/core/sock.c:2178 [inline] __sk_free+0x175/0x460 net/core/sock.c:2189 sk_free+0x7c/0xa0 net/core/sock.c:2200 sock_put include/net/sock.h:1968 [inline] nr_release+0x39e/0x460 net/netrom/af_netrom.c:559 __sock_release+0xcd/0x290 net/socket.c:653 sock_close+0x1c/0x20 net/socket.c:1397 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491 __call_rcu_common.constprop.0+0x99/0x7e0 kernel/rcu/tree.c:2627 qdisc_put+0xd1/0xf0 net/sched/sch_generic.c:1082 shutdown_scheduler_queue net/sched/sch_generic.c:1135 [inline] netdev_for_each_tx_queue include/linux/netdevice.h:2514 [inline] dev_shutdown+0x11e/0x580 net/sched/sch_generic.c:1467 unregister_netdevice_many_notify+0x5fc/0x18c0 net/core/dev.c:10872 unregister_netdevice_many net/core/dev.c:10938 [inline] unregister_netdevice_queue+0x2e5/0x3c0 net/core/dev.c:10818 unregister_netdevice include/linux/netdevice.h:3109 [inline] __tun_detach+0x10a3/0x1400 drivers/net/tun.c:684 tun_detach drivers/net/tun.c:700 [inline] tun_chr_close+0xc8/0x240 drivers/net/tun.c:3491 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491 __call_rcu_common.constprop.0+0x99/0x7e0 kernel/rcu/tree.c:2627 netlink_release+0xcde/0x1e40 net/netlink/af_netlink.c:828 __sock_release net/socket.c:653 [inline] sock_release+0x8b/0x1d0 net/socket.c:681 netlink_kernel_release+0x4f/0x60 net/netlink/af_netlink.c:2098 nl_fib_lookup_exit net/ipv4/fib_frontend.c:1418 [inline] fib_net_exit+0x40/0x80 net/ipv4/fib_frontend.c:1631 ops_exit_list+0xb0/0x170 net/core/net_namespace.c:170 setup_net+0x7fb/0xc50 net/core/net_namespace.c:362 copy_net_ns+0x4ee/0x8e0 net/core/net_namespace.c:491 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:228 ksys_unshare+0x449/0x920 kernel/fork.c:3444 __do_sys_unshare kernel/fork.c:3515 [inline] __se_sys_unshare kernel/fork.c:3513 [inline] __x64_sys_unshare+0x31/0x40 kernel/fork.c:3513 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff8880a1b10000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 128 bytes inside of freed 2048-byte region [ffff8880a1b10000, ffff8880a1b10800) The buggy address belongs to the physical page: page:ffffea000286c400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xa1b10 head:ffffea000286c400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012442000 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 28051, tgid 28040 (syz-executor.0), ts 1753027101227, free_ts 1750300294400 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x25f/0x390 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3192 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291 __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc_node_track_caller+0x4f/0x1a0 mm/slab_common.c:986 kmalloc_reserve+0xf0/0x270 net/core/skbuff.c:574 __alloc_skb+0x129/0x330 net/core/skbuff.c:643 alloc_skb include/linux/skbuff.h:1288 [inline] nlmsg_new include/net/netlink.h:1003 [inline] rtmsg_ifinfo_build_skb+0x7e/0x280 net/core/rtnetlink.c:3986 rtmsg_ifinfo_event net/core/rtnetlink.c:4029 [inline] rtmsg_ifinfo_event net/core/rtnetlink.c:4019 [inline] rtmsg_ifinfo+0x9f/0x1a0 net/core/rtnetlink.c:4038 register_netdevice+0x1235/0x1640 net/core/dev.c:10132 __ip_tunnel_create+0x398/0x5b0 net/ipv4/ip_tunnel.c:267 ip_tunnel_init_net+0x1f9/0x5d0 net/ipv4/ip_tunnel.c:1091 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2564 free_unref_page+0x33/0x370 mm/page_alloc.c:2659 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2636 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x195/0x220 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:711 [inline] slab_alloc_node mm/slub.c:3451 [inline] __kmem_cache_alloc_node+0x17c/0x320 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc+0x4e/0x190 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] sock_kmalloc+0xb2/0x100 net/core/sock.c:2630 af_alg_get_rsgl+0xda/0x620 crypto/af_alg.c:1304 _skcipher_recvmsg crypto/algif_skcipher.c:77 [inline] skcipher_recvmsg+0x8d8/0xe20 crypto/algif_skcipher.c:157 sock_recvmsg_nosec net/socket.c:1019 [inline] sock_recvmsg+0xe2/0x160 net/socket.c:1040 ____sys_recvmsg+0x210/0x5a0 net/socket.c:2724 ___sys_recvmsg+0xf2/0x180 net/socket.c:2766 do_recvmmsg+0x25e/0x6f0 net/socket.c:2860 __sys_recvmmsg net/socket.c:2939 [inline] __do_sys_recvmmsg net/socket.c:2962 [inline] __se_sys_recvmmsg net/socket.c:2955 [inline] __x64_sys_recvmmsg+0x20f/0x260 net/socket.c:2955 Memory state around the buggy address: ffff8880a1b0ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880a1b10000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880a1b10080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a1b10100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a1b10180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================