================================================================== BUG: KASAN: use-after-free in read_pnet include/net/net_namespace.h:361 [inline] BUG: KASAN: use-after-free in ib2_net include/net/inet_hashtables.h:116 [inline] BUG: KASAN: use-after-free in check_bind2_bucket_match net/ipv4/inet_hashtables.c:765 [inline] BUG: KASAN: use-after-free in inet_bind2_bucket_find+0x562/0x620 net/ipv4/inet_hashtables.c:819 Read of size 8 at addr ffff88807eb84a80 by task syz-executor.2/10820 CPU: 1 PID: 10820 Comm: syz-executor.2 Not tainted 5.18.0-syzkaller-10139-g8291eaafed36 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 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+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 read_pnet include/net/net_namespace.h:361 [inline] ib2_net include/net/inet_hashtables.h:116 [inline] check_bind2_bucket_match net/ipv4/inet_hashtables.c:765 [inline] inet_bind2_bucket_find+0x562/0x620 net/ipv4/inet_hashtables.c:819 __inet_inherit_port+0x967/0x12a0 net/ipv4/inet_hashtables.c:236 dccp_v6_request_recv_sock+0x9e0/0x1900 net/dccp/ipv6.c:546 dccp_check_req+0x338/0x6a0 net/dccp/minisocks.c:195 dccp_v6_rcv+0x6df/0x1880 net/dccp/ipv6.c:759 ip6_protocol_deliver_rcu+0x2e1/0x1930 net/ipv6/ip6_input.c:436 ip6_input_finish+0x14c/0x2c0 net/ipv6/ip6_input.c:481 NF_HOOK include/linux/netfilter.h:307 [inline] NF_HOOK include/linux/netfilter.h:301 [inline] ip6_input+0x9c/0xd0 net/ipv6/ip6_input.c:490 dst_input include/net/dst.h:461 [inline] ip6_rcv_finish net/ipv6/ip6_input.c:76 [inline] NF_HOOK include/linux/netfilter.h:307 [inline] NF_HOOK include/linux/netfilter.h:301 [inline] ipv6_rcv+0x27f/0x3b0 net/ipv6/ip6_input.c:306 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5478 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5592 process_backlog+0x3a0/0x7c0 net/core/dev.c:5920 __napi_poll+0xb3/0x6e0 net/core/dev.c:6486 napi_poll net/core/dev.c:6553 [inline] net_rx_action+0x9c1/0xd90 net/core/dev.c:6664 __do_softirq+0x29b/0x9c2 kernel/softirq.c:571 do_softirq.part.0+0xde/0x130 kernel/softirq.c:472 do_softirq kernel/softirq.c:464 [inline] __local_bh_enable_ip+0x102/0x120 kernel/softirq.c:396 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:765 [inline] ip6_finish_output2+0x5b2/0x1520 net/ipv6/ip6_output.c:135 __ip6_finish_output net/ipv6/ip6_output.c:195 [inline] ip6_finish_output+0x844/0x1170 net/ipv6/ip6_output.c:206 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip6_output+0x1ed/0x540 net/ipv6/ip6_output.c:227 dst_output include/net/dst.h:451 [inline] NF_HOOK include/linux/netfilter.h:307 [inline] NF_HOOK include/linux/netfilter.h:301 [inline] ip6_xmit+0x11f3/0x1c50 net/ipv6/ip6_output.c:343 inet6_csk_xmit+0x3b1/0x6c0 net/ipv6/inet6_connection_sock.c:135 dccp_transmit_skb+0x973/0x12c0 net/dccp/output.c:138 dccp_send_ack.part.0+0x16b/0x2f0 net/dccp/output.c:600 dccp_send_ack+0x53/0x70 net/dccp/output.c:584 dccp_rcv_request_sent_state_process net/dccp/input.c:497 [inline] dccp_rcv_state_process+0x11cc/0x1820 net/dccp/input.c:676 dccp_v6_do_rcv+0x287/0xb90 net/dccp/ipv6.c:653 sk_backlog_rcv include/net/sock.h:1061 [inline] __release_sock+0x134/0x3b0 net/core/sock.c:2849 release_sock+0x54/0x1b0 net/core/sock.c:3404 inet_wait_for_connect net/ipv4/af_inet.c:593 [inline] __inet_stream_connect+0x5db/0xed0 net/ipv4/af_inet.c:685 inet_stream_connect+0x53/0xa0 net/ipv4/af_inet.c:724 __sys_connect_file+0x14f/0x190 net/socket.c:1979 __sys_connect+0x161/0x190 net/socket.c:1996 __do_sys_connect net/socket.c:2006 [inline] __se_sys_connect net/socket.c:2003 [inline] __x64_sys_connect+0x6f/0xb0 net/socket.c:2003 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 RIP: 0033:0x7f4f3d289109 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4f3e333168 EFLAGS: 00000246 ORIG_RAX: 000000000000002a RAX: ffffffffffffffda RBX: 00007f4f3d39bf60 RCX: 00007f4f3d289109 RDX: 000000000000001c RSI: 0000000020419000 RDI: 0000000000000006 RBP: 00007f4f3d2e308d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f4f3d8cfb1f R14: 00007f4f3e333300 R15: 0000000000022000 Allocated by task 10597: 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_slab_alloc+0x90/0xc0 mm/kasan/common.c:469 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3214 [inline] slab_alloc mm/slub.c:3222 [inline] __kmem_cache_alloc_lru mm/slub.c:3229 [inline] kmem_cache_alloc+0x204/0x3b0 mm/slub.c:3239 inet_bind2_bucket_create+0x37/0x360 net/ipv4/inet_hashtables.c:91 inet_csk_get_port+0x1992/0x1ad0 net/ipv4/inet_connection_sock.c:501 __inet6_bind+0x621/0x1b30 net/ipv6/af_inet6.c:405 inet6_bind+0x173/0x220 net/ipv6/af_inet6.c:464 __sys_bind+0x1e9/0x250 net/socket.c:1776 __do_sys_bind net/socket.c:1787 [inline] __se_sys_bind net/socket.c:1785 [inline] __x64_sys_bind+0x6f/0xb0 net/socket.c:1785 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 10597: 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/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1727 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1753 slab_free mm/slub.c:3507 [inline] kmem_cache_free+0xdd/0x5a0 mm/slub.c:3524 inet_bind2_bucket_destroy net/ipv4/inet_hashtables.c:137 [inline] inet_bind2_bucket_destroy+0xdf/0x120 net/ipv4/inet_hashtables.c:133 inet_csk_get_port+0x10a5/0x1ad0 net/ipv4/inet_connection_sock.c:533 __inet6_bind+0x621/0x1b30 net/ipv6/af_inet6.c:405 inet6_bind+0x173/0x220 net/ipv6/af_inet6.c:464 __sys_bind+0x1e9/0x250 net/socket.c:1776 __do_sys_bind net/socket.c:1787 [inline] __se_sys_bind net/socket.c:1785 [inline] __x64_sys_bind+0x6f/0xb0 net/socket.c:1785 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 The buggy address belongs to the object at ffff88807eb84a80 which belongs to the cache dccp_bind2_bucket of size 56 The buggy address is located 0 bytes inside of 56-byte region [ffff88807eb84a80, ffff88807eb84ab8) The buggy address belongs to the physical page: page:ffffea0001fae100 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807eb84c00 pfn:0x7eb84 memcg:ffff888077db3201 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00006b4200 dead000000000003 ffff888024a70b40 raw: ffff88807eb84c00 0000000080200013 00000001ffffffff ffff888077db3201 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 4789, tgid 4787 (syz-executor.3), ts 164142586794, free_ts 162795276404 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x1290/0x3b70 mm/page_alloc.c:4198 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1797 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1942 new_slab mm/slub.c:2002 [inline] ___slab_alloc+0x985/0xd90 mm/slub.c:3002 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3089 slab_alloc_node mm/slub.c:3180 [inline] slab_alloc mm/slub.c:3222 [inline] __kmem_cache_alloc_lru mm/slub.c:3229 [inline] kmem_cache_alloc+0x360/0x3b0 mm/slub.c:3239 inet_bind2_bucket_create+0x37/0x360 net/ipv4/inet_hashtables.c:91 __inet_hash_connect+0xef5/0x1450 net/ipv4/inet_hashtables.c:951 dccp_v6_connect+0x9e2/0x14e0 net/dccp/ipv6.c:954 __inet_stream_connect+0x8cf/0xed0 net/ipv4/af_inet.c:660 inet_stream_connect+0x53/0xa0 net/ipv4/af_inet.c:724 __sys_connect_file+0x14f/0x190 net/socket.c:1979 __sys_connect+0x161/0x190 net/socket.c:1996 __do_sys_connect net/socket.c:2006 [inline] __se_sys_connect net/socket.c:2003 [inline] __x64_sys_connect+0x6f/0xb0 net/socket.c:2003 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1421 free_unref_page_prepare mm/page_alloc.c:3343 [inline] free_unref_page_list+0x16f/0xf80 mm/page_alloc.c:3475 release_pages+0xff1/0x2290 mm/swap.c:980 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+0x1de/0x4a0 mm/mmap.c:3147 __mmput+0x122/0x4b0 kernel/fork.c:1187 mmput+0x56/0x60 kernel/fork.c:1208 exit_mm kernel/exit.c:510 [inline] do_exit+0xa12/0x2a00 kernel/exit.c:782 do_group_exit+0xd2/0x2f0 kernel/exit.c:925 get_signal+0x22df/0x24c0 kernel/signal.c:2875 arch_do_signal_or_restart+0x82/0x20f0 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: ffff88807eb84980: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc ffff88807eb84a00: fa fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc >ffff88807eb84a80: fa fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc ^ ffff88807eb84b00: fa fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc ffff88807eb84b80: fa fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc ==================================================================