================================================================== BUG: KASAN: use-after-free in skb_copy_bits+0x6f0/0x780 net/core/skbuff.c:2374 Read of size 4 at addr ffff888024e37930 by task kworker/1:20/10693 CPU: 1 PID: 10693 Comm: kworker/1:20 Not tainted 5.16.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events nsim_dev_trap_report_work 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 skb_copy_bits+0x6f0/0x780 net/core/skbuff.c:2374 __skb_header_pointer include/linux/skbuff.h:3743 [inline] skb_header_pointer include/linux/skbuff.h:3752 [inline] do_basic_checks net/netfilter/nf_conntrack_proto_sctp.c:174 [inline] nf_conntrack_sctp_packet+0xe34/0x2500 net/netfilter/nf_conntrack_proto_sctp.c:383 nf_conntrack_handle_packet net/netfilter/nf_conntrack_core.c:1845 [inline] nf_conntrack_in+0xfe8/0x15e0 net/netfilter/nf_conntrack_core.c:1918 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline] nf_hook_slow+0xc5/0x1e0 net/netfilter/core.c:619 nf_hook.constprop.0+0x3ac/0x650 include/linux/netfilter.h:262 NF_HOOK include/linux/netfilter.h:305 [inline] ipv6_rcv+0x9e/0x3c0 net/ipv6/ip6_input.c:297 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5462 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5576 process_backlog+0x2a5/0x6c0 net/core/dev.c:6452 __napi_poll+0xaf/0x440 net/core/dev.c:7020 napi_poll net/core/dev.c:7087 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:7174 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:636 irq_exit_rcu+0x5/0x20 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:memory_is_nonzero mm/kasan/generic.c:114 [inline] RIP: 0010:memory_is_poisoned_n mm/kasan/generic.c:128 [inline] RIP: 0010:memory_is_poisoned mm/kasan/generic.c:159 [inline] RIP: 0010:check_region_inline mm/kasan/generic.c:180 [inline] RIP: 0010:kasan_check_range+0xa0/0x180 mm/kasan/generic.c:189 Code: 0f 49 da 49 c1 fb 03 45 85 db 0f 84 cb 00 00 00 45 89 db 4a 8d 14 d8 eb 0d 48 83 c0 08 48 39 d0 0f 84 af 00 00 00 48 83 38 00 <74> ed 48 8d 50 08 eb 09 48 83 c0 01 48 39 d0 74 7a 80 38 00 74 f2 RSP: 0018:ffffc90002bb7bd8 EFLAGS: 00000246 RAX: ffffed100e3359c0 RBX: ffffed100e3359d0 RCX: ffffffff87243239 RDX: ffffed100e3359d0 RSI: 00000000000000c0 RDI: ffff8880719acdc0 RBP: ffffed100e3359b8 R08: 0000000000000001 R09: ffff8880719ace7f R10: ffffed100e3359cf R11: 0000000000000003 R12: 00000000000000c0 R13: 0000000000000000 R14: 0000000000000a20 R15: 0000000000001000 memset+0x20/0x40 mm/kasan/shadow.c:44 memset include/linux/fortify-string.h:209 [inline] __alloc_skb+0x119/0x340 net/core/skbuff.c:442 alloc_skb include/linux/skbuff.h:1126 [inline] nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:745 [inline] nsim_dev_trap_report drivers/net/netdevsim/dev.c:802 [inline] nsim_dev_trap_report_work+0x29a/0xbc0 drivers/net/netdevsim/dev.c:843 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 29206: 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] kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3270 __alloc_skb+0x215/0x340 net/core/skbuff.c:414 alloc_skb include/linux/skbuff.h:1126 [inline] sctp_packet_pack net/sctp/output.c:471 [inline] sctp_packet_transmit+0xcca/0x3070 net/sctp/output.c:620 sctp_packet_transmit_chunk+0x114/0x260 net/sctp/output.c:193 sctp_outq_flush_data+0xa1a/0x26c0 net/sctp/outqueue.c:1101 sctp_outq_flush net/sctp/outqueue.c:1207 [inline] sctp_outq_uncork+0x178/0x200 net/sctp/outqueue.c:758 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1812 [inline] sctp_side_effects net/sctp/sm_sideeffect.c:1195 [inline] sctp_do_sm+0x745/0x4ed0 net/sctp/sm_sideeffect.c:1166 sctp_assoc_bh_rcv+0x386/0x6c0 net/sctp/associola.c:1054 sctp_inq_push+0x1da/0x270 net/sctp/inqueue.c:80 sctp_backlog_rcv+0x19e/0x5b0 net/sctp/input.c:344 sk_backlog_rcv include/net/sock.h:1030 [inline] __release_sock+0x134/0x3b0 net/core/sock.c:2768 release_sock+0x54/0x1b0 net/core/sock.c:3300 sctp_wait_for_connect+0x1cb/0x5d0 net/sctp/socket.c:9306 sctp_sendmsg_to_asoc+0x1828/0x2390 net/sctp/socket.c:1881 sctp_sendmsg+0x103b/0x1d30 net/sctp/socket.c:2027 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 __sys_sendto+0x21c/0x320 net/socket.c:2036 __do_sys_sendto net/socket.c:2048 [inline] __se_sys_sendto net/socket.c:2044 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2044 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 29206: 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 kfree_skbmem+0xef/0x1b0 net/core/skbuff.c:700 __kfree_skb net/core/skbuff.c:757 [inline] consume_skb net/core/skbuff.c:912 [inline] consume_skb+0xcf/0x160 net/core/skbuff.c:906 sctp_chunk_destroy net/sctp/sm_make_chunk.c:1503 [inline] sctp_chunk_put+0x1c0/0x2d0 net/sctp/sm_make_chunk.c:1530 sctp_inq_free+0x17f/0x260 net/sctp/inqueue.c:56 sctp_association_free+0x229/0x7d0 net/sctp/associola.c:348 sctp_cmd_delete_tcb net/sctp/sm_sideeffect.c:940 [inline] sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1324 [inline] sctp_side_effects net/sctp/sm_sideeffect.c:1195 [inline] sctp_do_sm+0x3665/0x4ed0 net/sctp/sm_sideeffect.c:1166 sctp_assoc_bh_rcv+0x386/0x6c0 net/sctp/associola.c:1054 sctp_inq_push+0x1da/0x270 net/sctp/inqueue.c:80 sctp_backlog_rcv+0x19e/0x5b0 net/sctp/input.c:344 sk_backlog_rcv include/net/sock.h:1030 [inline] __release_sock+0x134/0x3b0 net/core/sock.c:2768 release_sock+0x54/0x1b0 net/core/sock.c:3300 sctp_wait_for_connect+0x1cb/0x5d0 net/sctp/socket.c:9306 sctp_sendmsg_to_asoc+0x1828/0x2390 net/sctp/socket.c:1881 sctp_sendmsg+0x103b/0x1d30 net/sctp/socket.c:2027 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:724 __sys_sendto+0x21c/0x320 net/socket.c:2036 __do_sys_sendto net/socket.c:2048 [inline] __se_sys_sendto net/socket.c:2044 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2044 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 The buggy address belongs to the object at ffff888024e378c0 which belongs to the cache skbuff_head_cache of size 232 The buggy address is located 112 bytes inside of 232-byte region [ffff888024e378c0, ffff888024e379a8) The buggy address belongs to the page: page:ffffea0000938dc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x24e37 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 0000000000000000 dead000000000122 ffff8881447ce140 raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY), pid 29206, ts 616865390957, free_ts 614461187178 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 skb_clone+0x170/0x3c0 net/core/skbuff.c:1521 sctp_ulpevent_make_rcvmsg+0x2aa/0xb40 net/sctp/ulpevent.c:701 sctp_ulpq_tail_data+0xa6/0xec0 net/sctp/ulpqueue.c:93 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1454 [inline] sctp_side_effects net/sctp/sm_sideeffect.c:1195 [inline] sctp_do_sm+0x389b/0x4ed0 net/sctp/sm_sideeffect.c:1166 sctp_assoc_bh_rcv+0x386/0x6c0 net/sctp/associola.c:1054 sctp_inq_push+0x1da/0x270 net/sctp/inqueue.c:80 sctp_backlog_rcv+0x19e/0x5b0 net/sctp/input.c:344 sk_backlog_rcv include/net/sock.h:1030 [inline] __release_sock+0x134/0x3b0 net/core/sock.c:2768 release_sock+0x54/0x1b0 net/core/sock.c:3300 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_list+0x1a9/0xfa0 mm/page_alloc.c:3425 release_pages+0x3f4/0x1480 mm/swap.c:980 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:242 [inline] tlb_flush_mmu mm/mmu_gather.c:249 [inline] tlb_finish_mmu+0x165/0x8c0 mm/mmu_gather.c:340 exit_mmap+0x1ea/0x630 mm/mmap.c:3172 __mmput+0x122/0x4b0 kernel/fork.c:1113 mmput+0x56/0x60 kernel/fork.c:1134 exit_mm kernel/exit.c:507 [inline] do_exit+0xb27/0x2b40 kernel/exit.c:819 do_group_exit+0x125/0x310 kernel/exit.c:929 get_signal+0x47d/0x2220 kernel/signal.c:2852 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff888024e37800: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc ffff888024e37880: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb >ffff888024e37900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888024e37980: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc ffff888024e37a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess): 0: 0f 49 da cmovns %edx,%ebx 3: 49 c1 fb 03 sar $0x3,%r11 7: 45 85 db test %r11d,%r11d a: 0f 84 cb 00 00 00 je 0xdb 10: 45 89 db mov %r11d,%r11d 13: 4a 8d 14 d8 lea (%rax,%r11,8),%rdx 17: eb 0d jmp 0x26 19: 48 83 c0 08 add $0x8,%rax 1d: 48 39 d0 cmp %rdx,%rax 20: 0f 84 af 00 00 00 je 0xd5 26: 48 83 38 00 cmpq $0x0,(%rax) * 2a: 74 ed je 0x19 <-- trapping instruction 2c: 48 8d 50 08 lea 0x8(%rax),%rdx 30: eb 09 jmp 0x3b 32: 48 83 c0 01 add $0x1,%rax 36: 48 39 d0 cmp %rdx,%rax 39: 74 7a je 0xb5 3b: 80 38 00 cmpb $0x0,(%rax) 3e: 74 f2 je 0x32