syzbot


KASAN: invalid-free in tcp_cdg_release

Status: auto-closed as invalid on 2020/04/30 18:08
Subsystems: net
[Documentation on labels]
First crash: 1545d, last: 1545d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: invalid-free in tcp_cdg_release 1 1564d 1564d 0/1 auto-closed as invalid on 2020/05/11 03:44

Sample crash report:
==================================================================
BUG: KASAN: double-free or invalid-free in tcp_cdg_release+0x37/0x50 net/ipv4/tcp_cdg.c:390

CPU: 0 PID: 11504 Comm: syz-executor.2 Not tainted 5.5.0-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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 kasan_report_invalid_free+0x65/0xa0 mm/kasan/report.c:468
 __kasan_slab_free+0x13a/0x150 mm/kasan/common.c:453
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3757
 tcp_cdg_release+0x37/0x50 net/ipv4/tcp_cdg.c:390
 tcp_cleanup_congestion_control+0x71/0x130 net/ipv4/tcp_cong.c:210
 tcp_v4_destroy_sock+0xf0/0x8b0 net/ipv4/tcp_ipv4.c:2157
 tcp_v6_destroy_sock+0x16/0x30 net/ipv6/tcp_ipv6.c:1881
 inet_csk_destroy_sock+0x1a7/0x4c0 net/ipv4/inet_connection_sock.c:844
 tcp_done+0x288/0x3a0 net/ipv4/tcp.c:3869
 tcp_v6_syn_recv_sock+0x1e21/0x24a0 net/ipv6/tcp_ipv6.c:1348
 tcp_check_req+0x688/0x17b0 net/ipv4/tcp_minisocks.c:770
 tcp_v6_rcv+0x21e8/0x3690 net/ipv6/tcp_ipv6.c:1612
 ip6_protocol_deliver_rcu+0x2fe/0x1670 net/ipv6/ip6_input.c:432
 ip6_input_finish+0x84/0x170 net/ipv6/ip6_input.c:473
 NF_HOOK include/linux/netfilter.h:307 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip6_input+0xe4/0x3f0 net/ipv6/ip6_input.c:482
 dst_input include/net/dst.h:442 [inline]
 ip6_rcv_finish+0x1de/0x310 net/ipv6/ip6_input.c:76
 NF_HOOK include/linux/netfilter.h:307 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ipv6_rcv+0x10e/0x420 net/ipv6/ip6_input.c:306
 __netif_receive_skb_one_core+0x113/0x1a0 net/core/dev.c:5198
 __netif_receive_skb+0x2c/0x1d0 net/core/dev.c:5312
 process_backlog+0x206/0x750 net/core/dev.c:6144
 napi_poll net/core/dev.c:6582 [inline]
 net_rx_action+0x508/0x1120 net/core/dev.c:6650
 __do_softirq+0x262/0x98c kernel/softirq.c:292
 do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1082
 </IRQ>
 do_softirq.part.0+0x11a/0x170 kernel/softirq.c:337
 do_softirq kernel/softirq.c:329 [inline]
 __local_bh_enable_ip+0x211/0x270 kernel/softirq.c:189
 local_bh_enable include/linux/bottom_half.h:32 [inline]
 rcu_read_unlock_bh include/linux/rcupdate.h:690 [inline]
 ip6_finish_output2+0x1101/0x25c0 net/ipv6/ip6_output.c:117
 __ip6_finish_output+0x444/0xaa0 net/ipv6/ip6_output.c:142
 ip6_finish_output+0x38/0x1f0 net/ipv6/ip6_output.c:152
 NF_HOOK_COND include/linux/netfilter.h:296 [inline]
 ip6_output+0x25e/0x880 net/ipv6/ip6_output.c:175
 dst_output include/net/dst.h:436 [inline]
 NF_HOOK include/linux/netfilter.h:307 [inline]
 NF_HOOK include/linux/netfilter.h:301 [inline]
 ip6_xmit+0xe1a/0x2090 net/ipv6/ip6_output.c:279
 inet6_csk_xmit+0x339/0x610 net/ipv6/inet6_connection_sock.c:135
 __tcp_transmit_skb+0x1ac9/0x3900 net/ipv4/tcp_output.c:1234
 tcp_transmit_skb net/ipv4/tcp_output.c:1250 [inline]
 tcp_write_xmit+0xf91/0x5bf0 net/ipv4/tcp_output.c:2513
 __tcp_push_pending_frames+0xb4/0x350 net/ipv4/tcp_output.c:2689
 tcp_send_fin+0x12a/0xd70 net/ipv4/tcp_output.c:3235
 tcp_close+0xc25/0x1290 net/ipv4/tcp.c:2425
 inet_release+0xed/0x200 net/ipv4/af_inet.c:427
 inet6_release+0x53/0x80 net/ipv6/af_inet6.c:470
 __sock_release+0xce/0x280 net/socket.c:605
 sock_close+0x1e/0x30 net/socket.c:1283
 __fput+0x2ff/0x890 fs/file_table.c:280
 ____fput+0x16/0x20 fs/file_table.c:313
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 get_signal+0x206e/0x24f0 kernel/signal.c:2528
 do_signal+0x87/0x1700 arch/x86/kernel/signal.c:813
 exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:278 [inline]
 do_syscall_64+0x676/0x790 arch/x86/entry/common.c:304
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45b349
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f1d270fac78 EFLAGS: 00000246 ORIG_RAX: 000000000000002d
RAX: fffffffffffffe00 RBX: 00007f1d270fb6d4 RCX: 000000000045b349
RDX: fffffffffffffe3c RSI: 00000000200001c0 RDI: 0000000000000004
RBP: 000000000075bf20 R08: 0000000020001880 R09: 000000000000017c
R10: 0000000000000100 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000883 R14: 00000000004c9e71 R15: 000000000075bf2c

Allocated by task 11508:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
 __do_kmalloc mm/slab.c:3656 [inline]
 __kmalloc+0x163/0x770 mm/slab.c:3665
 kmalloc_array include/linux/slab.h:598 [inline]
 kcalloc include/linux/slab.h:609 [inline]
 tcp_cdg_init+0x11f/0x180 net/ipv4/tcp_cdg.c:380
 tcp_init_congestion_control+0xac/0x450 net/ipv4/tcp_cong.c:183
 tcp_reinit_congestion_control+0xd1/0x100 net/ipv4/tcp_cong.c:201
 tcp_set_congestion_control+0x568/0x602 net/ipv4/tcp_cong.c:384
 do_tcp_setsockopt.isra.0+0x46d/0x2500 net/ipv4/tcp.c:2814
 tcp_setsockopt+0xbe/0xe0 net/ipv4/tcp.c:3161
 sock_common_setsockopt+0x94/0xd0 net/core/sock.c:3149
 __sys_setsockopt+0x261/0x4c0 net/socket.c:2130
 __do_sys_setsockopt net/socket.c:2146 [inline]
 __se_sys_setsockopt net/socket.c:2143 [inline]
 __x64_sys_setsockopt+0xbe/0x150 net/socket.c:2143
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 11508:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:335 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3757
 tcp_cdg_release+0x37/0x50 net/ipv4/tcp_cdg.c:390
 tcp_cleanup_congestion_control+0x71/0x130 net/ipv4/tcp_cong.c:210
 tcp_v4_destroy_sock+0xf0/0x8b0 net/ipv4/tcp_ipv4.c:2157
 tcp_v6_destroy_sock+0x16/0x30 net/ipv6/tcp_ipv6.c:1881
 inet_csk_destroy_sock+0x1a7/0x4c0 net/ipv4/inet_connection_sock.c:844
 tcp_close+0xdf9/0x1290 net/ipv4/tcp.c:2503
 inet_release+0xed/0x200 net/ipv4/af_inet.c:427
 inet6_release+0x53/0x80 net/ipv6/af_inet6.c:470
 __sock_release+0xce/0x280 net/socket.c:605
 sock_close+0x1e/0x30 net/socket.c:1283
 __fput+0x2ff/0x890 fs/file_table.c:280
 ____fput+0x16/0x20 fs/file_table.c:313
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 get_signal+0x206e/0x24f0 kernel/signal.c:2528
 do_signal+0x87/0x1700 arch/x86/kernel/signal.c:813
 exit_to_usermode_loop+0x286/0x380 arch/x86/entry/common.c:160
 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:278 [inline]
 do_syscall_64+0x676/0x790 arch/x86/entry/common.c:304
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88808c76cf80
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff88808c76cf80, ffff88808c76cfc0)
The buggy address belongs to the page:
page:ffffea000231db00 refcount:1 mapcount:0 mapping:ffff8880aa400380 index:0x0
raw: 00fffe0000000200 ffffea00023c0e48 ffffea000258d888 ffff8880aa400380
raw: 0000000000000000 ffff88808c76c000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808c76ce80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff88808c76cf00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff88808c76cf80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff88808c76d000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88808c76d080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/31 17:59 net-old 9f68e3655aae 5ed23f9a .config console log report ci-upstream-net-this-kasan-gce
* Struck through repros no longer work on HEAD.