syzbot


KASAN: use-after-free Read in skb_copy_bits

Status: auto-closed as invalid on 2022/06/04 10:20
Subsystems: netfilter
[Documentation on labels]
First crash: 1084d, last: 947d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: wild-memory-access Read in skb_copy_bits net C 2 761d 761d 22/28 fixed on 2023/02/24 13:51

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in skb_copy_bits+0x6f0/0x780 net/core/skbuff.c:2396
Read of size 4 at addr ffff88807a9f7070 by task syz-executor.4/3653

CPU: 1 PID: 3653 Comm: syz-executor.4 Not tainted 5.17.0-rc6-syzkaller-00242-g0014404f9c18 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __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/0x336 mm/kasan/report.c:255
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
 skb_copy_bits+0x6f0/0x780 net/core/skbuff.c:2396
 __skb_header_pointer include/linux/skbuff.h:3782 [inline]
 skb_header_pointer include/linux/skbuff.h:3791 [inline]
 do_basic_checks net/netfilter/nf_conntrack_proto_sctp.c:174 [inline]
 nf_conntrack_sctp_packet+0xe77/0x2630 net/netfilter/nf_conntrack_proto_sctp.c:383
 nf_conntrack_handle_packet net/netfilter/nf_conntrack_core.c:1847 [inline]
 nf_conntrack_in+0xeb5/0x17f0 net/netfilter/nf_conntrack_core.c:1920
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_slow+0xc5/0x1e0 net/netfilter/core.c:620
 nf_hook.constprop.0+0x3ac/0x650 include/linux/netfilter.h:262
 NF_HOOK include/linux/netfilter.h:305 [inline]
 ipv6_rcv+0x9e/0x3b0 net/ipv6/ip6_input.c:297
 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5351
 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5465
 process_backlog+0x2a5/0x6c0 net/core/dev.c:5797
 __napi_poll+0xb3/0x6e0 net/core/dev.c:6365
 napi_poll net/core/dev.c:6432 [inline]
 net_rx_action+0x801/0xb40 net/core/dev.c:6519
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1097
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:lock_is_held_type+0xff/0x140 kernel/locking/lockdep.c:5687
Code: 00 00 b8 ff ff ff ff 65 0f c1 05 ec 6a b6 76 83 f8 01 75 29 9c 58 f6 c4 02 75 3d 48 f7 04 24 00 02 00 00 74 01 fb 48 83 c4 08 <44> 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 45 31 ed eb b9 0f 0b 48
RSP: 0018:ffffc9000291fb28 EFLAGS: 00000286
RAX: 0000000000000046 RBX: 0000000000000000 RCX: 0000000000000001
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000000
RBP: ffffffff8bb84520 R08: 0000000000000000 R09: ffffffff8d942557
R10: fffffbfff1b284aa R11: 0000000000000001 R12: ffff88807d880000
R13: 0000000000000000 R14: 00000000ffffffff R15: 0000000000000000
 lock_is_held include/linux/lockdep.h:283 [inline]
 rcu_read_lock_sched_held+0x3a/0x70 kernel/rcu/update.c:125
 trace_lock_acquire include/trace/events/lock.h:13 [inline]
 lock_acquire+0x442/0x510 kernel/locking/lockdep.c:5610
 __raw_read_lock include/linux/rwlock_api_smp.h:150 [inline]
 _raw_read_lock+0x5b/0x70 kernel/locking/spinlock.c:228
 do_wait+0x284/0xce0 kernel/exit.c:1518
 kernel_wait4+0x14c/0x260 kernel/exit.c:1691
 __do_compat_sys_wait4+0x137/0x150 kernel/exit.c:1749
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
RIP: 0023:0xf6ec6549
Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f7557d10 EFLAGS: 00000286 ORIG_RAX: 0000000000000072
RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00000000f7557de0
RDX: 0000000040000001 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000bb8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 3653:
 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:260 [inline]
 slab_post_alloc_hook mm/slab.h:732 [inline]
 slab_alloc_node mm/slub.c:3230 [inline]
 kmem_cache_alloc_node+0x2c3/0x4f0 mm/slub.c:3266
 __alloc_skb+0x215/0x340 net/core/skbuff.c:414
 alloc_skb include/linux/skbuff.h:1158 [inline]
 sctp_packet_pack net/sctp/output.c:471 [inline]
 sctp_packet_transmit+0xcca/0x3070 net/sctp/output.c:620
 sctp_outq_flush_transports+0x406/0x7b0 net/sctp/outqueue.c:1166
 sctp_outq_flush net/sctp/outqueue.c:1214 [inline]
 sctp_outq_uncork+0x185/0x200 net/sctp/outqueue.c:761
 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1812 [inline]
 sctp_side_effects net/sctp/sm_sideeffect.c:1195 [inline]
 sctp_do_sm+0x745/0x4f00 net/sctp/sm_sideeffect.c:1166
 sctp_assoc_bh_rcv+0x386/0x6c0 net/sctp/associola.c:1054
 sctp_inq_push+0x1d2/0x270 net/sctp/inqueue.c:80
 sctp_rcv+0xfb9/0x3290 net/sctp/input.c:256
 sctp6_rcv+0x38/0x60 net/sctp/ipv6.c:1109
 ip6_protocol_deliver_rcu+0x2e9/0x1d10 net/ipv6/ip6_input.c:422
 ip6_input_finish+0x62/0x170 net/ipv6/ip6_input.c:463
 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:472
 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:297
 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5351
 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5465
 process_backlog+0x2a5/0x6c0 net/core/dev.c:5797
 __napi_poll+0xb3/0x6e0 net/core/dev.c:6365
 napi_poll net/core/dev.c:6432 [inline]
 net_rx_action+0x801/0xb40 net/core/dev.c:6519
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558

Freed by task 3653:
 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+0x126/0x160 mm/kasan/common.c:328
 kasan_slab_free include/linux/kasan.h:236 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754
 slab_free mm/slub.c:3509 [inline]
 kmem_cache_free+0xd7/0x370 mm/slub.c:3526
 kfree_skbmem+0xef/0x1b0 net/core/skbuff.c:700
 __kfree_skb net/core/skbuff.c:757 [inline]
 consume_skb net/core/skbuff.c:914 [inline]
 consume_skb+0xcf/0x160 net/core/skbuff.c:908
 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+0x221/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+0x3855/0x4f00 net/sctp/sm_sideeffect.c:1166
 sctp_assoc_bh_rcv+0x386/0x6c0 net/sctp/associola.c:1054
 sctp_inq_push+0x1d2/0x270 net/sctp/inqueue.c:80
 sctp_rcv+0xfb9/0x3290 net/sctp/input.c:256
 sctp6_rcv+0x38/0x60 net/sctp/ipv6.c:1109
 ip6_protocol_deliver_rcu+0x2e9/0x1d10 net/ipv6/ip6_input.c:422
 ip6_input_finish+0x62/0x170 net/ipv6/ip6_input.c:463
 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:472
 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:297
 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5351
 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5465
 process_backlog+0x2a5/0x6c0 net/core/dev.c:5797
 __napi_poll+0xb3/0x6e0 net/core/dev.c:6365
 napi_poll net/core/dev.c:6432 [inline]
 net_rx_action+0x801/0xb40 net/core/dev.c:6519
 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558

The buggy address belongs to the object at ffff88807a9f7000
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 112 bytes inside of
 232-byte region [ffff88807a9f7000, ffff88807a9f70e8)
The buggy address belongs to the page:
page:ffffea0001ea7dc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7a9f7
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0000736f00 dead000000000002 ffff888015b84140
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 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 7776, ts 283036892493, free_ts 282122717713
 prep_new_page mm/page_alloc.c:2434 [inline]
 get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4165
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5389
 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2271
 alloc_slab_page mm/slub.c:1799 [inline]
 allocate_slab+0x27f/0x3c0 mm/slub.c:1944
 new_slab mm/slub.c:2004 [inline]
 ___slab_alloc+0xbe1/0x12b0 mm/slub.c:3018
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105
 slab_alloc_node mm/slub.c:3196 [inline]
 kmem_cache_alloc_node+0x190/0x4f0 mm/slub.c:3266
 __alloc_skb+0x215/0x340 net/core/skbuff.c:414
 alloc_skb include/linux/skbuff.h:1158 [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:1104
 sctp_outq_flush net/sctp/outqueue.c:1210 [inline]
 sctp_outq_uncork+0x178/0x200 net/sctp/outqueue.c:761
 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1812 [inline]
 sctp_side_effects net/sctp/sm_sideeffect.c:1195 [inline]
 sctp_do_sm+0x745/0x4f00 net/sctp/sm_sideeffect.c:1166
 sctp_assoc_bh_rcv+0x386/0x6c0 net/sctp/associola.c:1054
 sctp_inq_push+0x1d2/0x270 net/sctp/inqueue.c:80
 sctp_backlog_rcv+0x196/0x5a0 net/sctp/input.c:344
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1352 [inline]
 free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404
 free_unref_page_prepare mm/page_alloc.c:3325 [inline]
 free_unref_page+0x19/0x690 mm/page_alloc.c:3404
 ops_free_list.part.0+0x119/0x370 net/core/net_namespace.c:182
 ops_free_list net/core/net_namespace.c:180 [inline]
 cleanup_net+0x591/0xb00 net/core/net_namespace.c:601
 process_one_work+0x9ac/0x1650 kernel/workqueue.c:2307
 worker_thread+0x657/0x1110 kernel/workqueue.c:2454
 kthread+0x2e9/0x3a0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
 ffff88807a9f6f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807a9f6f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807a9f7000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88807a9f7080: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
 ffff88807a9f7100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	00 00                	add    %al,(%rax)
   2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
   7:	65 0f c1 05 ec 6a b6 	xadd   %eax,%gs:0x76b66aec(%rip)        # 0x76b66afb
   e:	76
   f:	83 f8 01             	cmp    $0x1,%eax
  12:	75 29                	jne    0x3d
  14:	9c                   	pushfq
  15:	58                   	pop    %rax
  16:	f6 c4 02             	test   $0x2,%ah
  19:	75 3d                	jne    0x58
  1b:	48 f7 04 24 00 02 00 	testq  $0x200,(%rsp)
  22:	00
  23:	74 01                	je     0x26
  25:	fb                   	sti
  26:	48 83 c4 08          	add    $0x8,%rsp
* 2a:	44 89 e8             	mov    %r13d,%eax <-- trapping instruction
  2d:	5b                   	pop    %rbx
  2e:	5d                   	pop    %rbp
  2f:	41 5c                	pop    %r12
  31:	41 5d                	pop    %r13
  33:	41 5e                	pop    %r14
  35:	41 5f                	pop    %r15
  37:	c3                   	retq
  38:	45 31 ed             	xor    %r13d,%r13d
  3b:	eb b9                	jmp    0xfffffff6
  3d:	0f 0b                	ud2
  3f:	48                   	rex.W

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/03/06 10:19 upstream 0014404f9c18 7bdd8b2c .config console log report info ci-upstream-kasan-gce-386 KASAN: use-after-free Read in skb_copy_bits
2022/02/02 11:17 net-old 3aa430d33b8d 4ebb2798 .config console log report info ci-upstream-net-this-kasan-gce KASAN: use-after-free Read in skb_copy_bits
2022/01/28 19:56 net-old 6449520391df 495e00c5 .config console log report info ci-upstream-net-this-kasan-gce KASAN: use-after-free Read in skb_copy_bits
2021/11/30 21:03 net-old 1a59c9c55585 80270552 .config console log report info ci-upstream-net-this-kasan-gce KASAN: use-after-free Read in skb_copy_bits
2021/10/20 21:05 net-old ba69fd9101f2 418a00eb .config console log report info ci-upstream-net-this-kasan-gce KASAN: use-after-free Read in skb_copy_bits
2022/03/02 03:31 net-next-old a02192151b7d 45a13a73 .config console log report info ci-upstream-net-kasan-gce KASAN: use-after-free Read in skb_copy_bits
2021/11/13 01:16 net-next-old 5833291ab6de 83f5c9b5 .config console log report info ci-upstream-net-kasan-gce KASAN: use-after-free Read in skb_copy_bits
* Struck through repros no longer work on HEAD.