================================================================== BUG: KASAN: use-after-free in inet_ctl_sock_destroy include/net/inet_common.h:65 [inline] BUG: KASAN: use-after-free in icmpv6_sk_exit+0x228/0x240 net/ipv6/icmp.c:1038 Read of size 8 at addr ffff88803c5ba180 by task kworker/u4:9/14184 CPU: 0 PID: 14184 Comm: kworker/u4:9 Not tainted 5.16.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 inet_ctl_sock_destroy include/net/inet_common.h:65 [inline] icmpv6_sk_exit+0x228/0x240 net/ipv6/icmp.c:1038 ops_exit_list+0xb0/0x160 net/core/net_namespace.c:168 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:593 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 16875: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x202/0x3a0 mm/slub.c:3247 sk_prot_alloc+0x5f/0x290 net/core/sock.c:1914 sk_alloc+0x30/0xa60 net/core/sock.c:1973 inet6_create net/ipv6/af_inet6.c:184 [inline] inet6_create+0x36f/0x1030 net/ipv6/af_inet6.c:111 __sock_create+0x353/0x790 net/socket.c:1464 inet_ctl_sock_create+0x88/0x1d0 net/ipv4/af_inet.c:1652 icmpv6_sk_init net/ipv6/icmp.c:1052 [inline] icmpv6_sk_init+0xfa/0x2d0 net/ipv6/icmp.c:1042 ops_init+0xaf/0x470 net/core/net_namespace.c:140 setup_net+0x40f/0xa30 net/core/net_namespace.c:326 copy_net_ns+0x318/0x760 net/core/net_namespace.c:470 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3075 __do_sys_unshare kernel/fork.c:3146 [inline] __se_sys_unshare kernel/fork.c:3144 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3144 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+0x44/0xae Freed by task 14184: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kmem_cache_free+0xbd/0x5d0 mm/slub.c:3530 sk_prot_free net/core/sock.c:1954 [inline] __sk_destruct+0x5a2/0x900 net/core/sock.c:2042 sk_destruct+0xbd/0xe0 net/core/sock.c:2057 __sk_free+0xef/0x3d0 net/core/sock.c:2068 sk_free net/core/sock.c:2079 [inline] sock_put include/net/sock.h:1878 [inline] sk_common_release+0x292/0x390 net/core/sock.c:3515 inet_release+0x12e/0x280 net/ipv4/af_inet.c:427 inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:479 __sock_release net/socket.c:649 [inline] sock_release+0x87/0x1b0 net/socket.c:677 inet_ctl_sock_destroy include/net/inet_common.h:65 [inline] icmpv6_sk_exit+0x14c/0x240 net/ipv6/icmp.c:1038 ops_exit_list+0xb0/0x160 net/core/net_namespace.c:168 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:593 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff88803c5b9d00 which belongs to the cache RAWv6 of size 1696 The buggy address is located 1152 bytes inside of 1696-byte region [ffff88803c5b9d00, ffff88803c5ba3a0) The buggy address belongs to the page: page:ffffea0000f16e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88803c5bc140 pfn:0x3c5b8 head:ffffea0000f16e00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001f3fe08 ffffea000206be08 ffff8880220d4b40 raw: ffff88803c5bc140 000000000011000e 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 16649, ts 1650106194645, free_ts 1648797249943 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3247 sk_prot_alloc+0x5f/0x290 net/core/sock.c:1914 sk_alloc+0x30/0xa60 net/core/sock.c:1973 inet6_create net/ipv6/af_inet6.c:184 [inline] inet6_create+0x36f/0x1030 net/ipv6/af_inet6.c:111 __sock_create+0x353/0x790 net/socket.c:1464 inet_ctl_sock_create+0x88/0x1d0 net/ipv4/af_inet.c:1652 ndisc_net_init+0x7b/0x220 net/ipv6/ndisc.c:1909 ops_init+0xaf/0x470 net/core/net_namespace.c:140 setup_net+0x40f/0xa30 net/core/net_namespace.c:326 copy_net_ns+0x318/0x760 net/core/net_namespace.c:470 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3270 alloc_task_struct_node kernel/fork.c:170 [inline] dup_task_struct kernel/fork.c:882 [inline] copy_process+0x5c4/0x75a0 kernel/fork.c:2023 kernel_clone+0xe7/0xab0 kernel/fork.c:2582 kernel_thread+0xb5/0xf0 kernel/fork.c:2634 call_usermodehelper_exec_work kernel/umh.c:174 [inline] call_usermodehelper_exec_work+0xcc/0x180 kernel/umh.c:160 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88803c5ba080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803c5ba100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88803c5ba180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803c5ba200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803c5ba280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================