syzbot


KASAN: slab-out-of-bounds Read in subflow_syn_recv_sock
Status: upstream: reported C repro on 2020/07/15 16:28
Reported-by: syzbot+be889269e2b87ab34afb@syzkaller.appspotmail.com
First crash: 680d, last: 676d

Cause bisection: failed (bisect log)

Fix bisection: failed (bisect log)

Sample crash report:
TCP: request_sock_TCPv6: Possible SYN flooding on port 20002. Sending cookies.  Check SNMP counters.
==================================================================
BUG: KASAN: slab-out-of-bounds in subflow_syn_recv_sock+0x945/0xd80 net/mptcp/subflow.c:447
Read of size 1 at addr ffff888087004150 by task syz-executor432/9397

CPU: 1 PID: 9397 Comm: syz-executor432 Not tainted 5.8.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 subflow_syn_recv_sock+0x945/0xd80 net/mptcp/subflow.c:447
 tcp_get_cookie_sock+0xca/0x510 net/ipv4/syncookies.c:209
 cookie_v6_check+0x14f2/0x2250 net/ipv6/syncookies.c:255
 tcp_v6_cookie_check net/ipv6/tcp_ipv6.c:1134 [inline]
 tcp_v6_do_rcv+0xf50/0x1290 net/ipv6/tcp_ipv6.c:1459
 tcp_v6_rcv+0x312b/0x3470 net/ipv6/tcp_ipv6.c:1670
 ip6_protocol_deliver_rcu+0x2e8/0x1670 net/ipv6/ip6_input.c:433
 ip6_input_finish+0x7f/0x160 net/ipv6/ip6_input.c:474
 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:483
 dst_input include/net/dst.h:449 [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+0x28e/0x3c0 net/ipv6/ip6_input.c:307
 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5281
 __netif_receive_skb+0x27/0x1c0 net/core/dev.c:5395
 process_backlog+0x28d/0x7f0 net/core/dev.c:6239
 napi_poll net/core/dev.c:6684 [inline]
 net_rx_action+0x4a1/0xe60 net/core/dev.c:6752
 __do_softirq+0x34c/0xa60 kernel/softirq.c:292
 asm_call_on_stack+0xf/0x20 arch/x86/entry/entry_64.S:711
 </IRQ>
 __run_on_irqstack arch/x86/include/asm/irq_stack.h:22 [inline]
 run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:48 [inline]
 do_softirq_own_stack+0x111/0x170 arch/x86/kernel/irq_64.c:77
 do_softirq kernel/softirq.c:337 [inline]
 do_softirq+0x16b/0x1e0 kernel/softirq.c:324
 __local_bh_enable_ip+0x1f8/0x250 kernel/softirq.c:189
 local_bh_enable include/linux/bottom_half.h:32 [inline]
 rcu_read_unlock_bh include/linux/rcupdate.h:723 [inline]
 ip6_finish_output2+0x91d/0x17b0 net/ipv6/ip6_output.c:118
 __ip6_finish_output net/ipv6/ip6_output.c:143 [inline]
 __ip6_finish_output+0x447/0xab0 net/ipv6/ip6_output.c:128
 ip6_finish_output+0x34/0x1f0 net/ipv6/ip6_output.c:153
 NF_HOOK_COND include/linux/netfilter.h:296 [inline]
 ip6_output+0x1db/0x520 net/ipv6/ip6_output.c:176
 dst_output include/net/dst.h:443 [inline]
 NF_HOOK include/linux/netfilter.h:307 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip6_xmit+0x1258/0x1e80 net/ipv6/ip6_output.c:280
 inet6_csk_xmit+0x339/0x610 net/ipv6/inet6_connection_sock.c:135
 __tcp_transmit_skb+0x1884/0x3690 net/ipv4/tcp_output.c:1240
 __tcp_send_ack.part.0+0x3aa/0x590 net/ipv4/tcp_output.c:3787
 __tcp_send_ack net/ipv4/tcp_output.c:3793 [inline]
 tcp_send_ack+0x7d/0xa0 net/ipv4/tcp_output.c:3793
 tcp_rcv_synsent_state_process net/ipv4/tcp_input.c:6058 [inline]
 tcp_rcv_state_process+0x374c/0x4add net/ipv4/tcp_input.c:6227
 tcp_v6_do_rcv+0x7ad/0x1290 net/ipv6/tcp_ipv6.c:1474
 sk_backlog_rcv include/net/sock.h:997 [inline]
 __release_sock+0x134/0x3a0 net/core/sock.c:2550
 release_sock+0x54/0x1b0 net/core/sock.c:3066
 tcp_sendmsg+0x36/0x40 net/ipv4/tcp.c:1442
 inet6_sendmsg+0x99/0xe0 net/ipv6/af_inet6.c:638
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 __sys_sendto+0x21c/0x320 net/socket.c:1995
 __do_sys_sendto net/socket.c:2007 [inline]
 __se_sys_sendto net/socket.c:2003 [inline]
 __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2003
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x4493d9
Code: Bad RIP value.
RSP: 002b:00007f00f4533d98 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00000000006dec48 RCX: 00000000004493d9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00000000006dec40 R08: 00000000200000c0 R09: 000000000000001c
R10: 0000000024004044 R11: 0000000000000246 R12: 00000000006dec4c
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001

Allocated by task 9397:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
 slab_post_alloc_hook mm/slab.h:586 [inline]
 slab_alloc mm/slab.c:3320 [inline]
 kmem_cache_alloc+0x12c/0x3b0 mm/slab.c:3484
 reqsk_alloc include/net/request_sock.h:84 [inline]
 inet_reqsk_alloc+0x91/0x710 net/ipv4/tcp_input.c:6516
 cookie_v6_check+0x5a5/0x2250 net/ipv6/syncookies.c:173
 tcp_v6_cookie_check net/ipv6/tcp_ipv6.c:1134 [inline]
 tcp_v6_do_rcv+0xf50/0x1290 net/ipv6/tcp_ipv6.c:1459
 tcp_v6_rcv+0x312b/0x3470 net/ipv6/tcp_ipv6.c:1670
 ip6_protocol_deliver_rcu+0x2e8/0x1670 net/ipv6/ip6_input.c:433
 ip6_input_finish+0x7f/0x160 net/ipv6/ip6_input.c:474
 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:483
 dst_input include/net/dst.h:449 [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+0x28e/0x3c0 net/ipv6/ip6_input.c:307
 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5281
 __netif_receive_skb+0x27/0x1c0 net/core/dev.c:5395
 process_backlog+0x28d/0x7f0 net/core/dev.c:6239
 napi_poll net/core/dev.c:6684 [inline]
 net_rx_action+0x4a1/0xe60 net/core/dev.c:6752
 __do_softirq+0x34c/0xa60 kernel/softirq.c:292

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff888087004000
 which belongs to the cache request_sock_TCPv6 of size 336
The buggy address is located 0 bytes to the right of
 336-byte region [ffff888087004000, ffff888087004150)
The buggy address belongs to the page:
page:ffffea00021c0100 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888087004ff6
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea0002a3c588 ffffea0002718048 ffff88809a4a4380
raw: ffff888087004ff6 ffff888087004000 000000010000000a 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888087004000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888087004080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888087004100: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
                                                 ^
 ffff888087004180: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888087004200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (5):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2020/07/15 17:23 upstream e9919e11e219 f3bec699 .config log report syz C
ci-upstream-net-this-kasan-gce 2020/07/15 03:44 net d113c0f2e0d2 609fb517 .config log report syz C
ci-upstream-net-this-kasan-gce 2020/07/19 06:09 net 2ccb0161a0e9 9c812472 .config log report
ci-upstream-net-this-kasan-gce 2020/07/18 05:33 net 473309fb8372 9c812472 .config log report
ci-upstream-net-this-kasan-gce 2020/07/15 03:22 net d113c0f2e0d2 609fb517 .config log report