KASAN: invalid-free in tcp_cdg_release

10 views
Skip to first unread message

syzbot

unread,
Jan 11, 2020, 10:44:09 PM1/11/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: cb1f9a16 Linux 4.19.94
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1499bc85e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=9d03b07719ed036e
dashboard link: https://syzkaller.appspot.com/bug?extid=c6dbbe6be31153b13b8b
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+c6dbbe...@syzkaller.appspotmail.com

SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2
BTRFS error (device loop3): open_ctree failed
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2
==================================================================
BUG: KASAN: double-free or invalid-free in tcp_cdg_release+0x37/0x50
net/ipv4/tcp_cdg.c:389
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2

CPU: 0 PID: 8122 Comm: syz-executor.0 Not tainted 4.19.94-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.cold+0x7c/0x20d mm/kasan/report.c:256
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2
kasan_report_invalid_free+0x65/0xa0 mm/kasan/report.c:336
__kasan_slab_free+0x13a/0x150 mm/kasan/kasan.c:501
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kfree+0xcf/0x220 mm/slab.c:3822
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2
tcp_cdg_release+0x37/0x50 net/ipv4/tcp_cdg.c:389
tcp_cleanup_congestion_control+0x71/0x100 net/ipv4/tcp_cong.c:209
tcp_v4_destroy_sock+0xff/0x7d0 net/ipv4/tcp_ipv4.c:1972
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2
tcp_v6_destroy_sock+0x16/0x30 net/ipv6/tcp_ipv6.c:1763
inet_csk_destroy_sock+0x19a/0x420 net/ipv4/inet_connection_sock.c:838
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2
tcp_done+0x29e/0x310 net/ipv4/tcp.c:3765
tcp_v6_syn_recv_sock+0x1c39/0x2310 net/ipv6/tcp_ipv6.c:1237
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2
tcp_get_cookie_sock+0xd5/0x700 net/ipv4/syncookies.c:213
SELinux: unrecognized netlink message: protocol=4 nlmsg_type=0
sclass=netlink_tcpdiag_socket pig=8169 comm=syz-executor.2
cookie_v6_check+0x1434/0x20d0 net/ipv6/syncookies.c:257
tcp_v6_cookie_check net/ipv6/tcp_ipv6.c:1029 [inline]
tcp_v6_do_rcv+0x10e7/0x13c0 net/ipv6/tcp_ipv6.c:1337
tcp_v6_rcv+0x2eaa/0x35a0 net/ipv6/tcp_ipv6.c:1546
ip6_input_finish+0x36f/0x17c0 net/ipv6/ip6_input.c:395
NF_HOOK include/linux/netfilter.h:289 [inline]
NF_HOOK include/linux/netfilter.h:283 [inline]
ip6_input+0xe4/0x3f0 net/ipv6/ip6_input.c:438
dst_input include/net/dst.h:453 [inline]
ip6_rcv_finish+0x1de/0x2f0 net/ipv6/ip6_input.c:76
NF_HOOK include/linux/netfilter.h:289 [inline]
NF_HOOK include/linux/netfilter.h:283 [inline]
ipv6_rcv+0x119/0x430 net/ipv6/ip6_input.c:283
__netif_receive_skb_one_core+0x113/0x1a0 net/core/dev.c:4947
__netif_receive_skb+0x2c/0x1d0 net/core/dev.c:5059
process_backlog+0x23a/0x7a0 net/core/dev.c:5870
napi_poll net/core/dev.c:6293 [inline]
net_rx_action+0x4f5/0x1070 net/core/dev.c:6359
__do_softirq+0x25c/0x921 kernel/softirq.c:292
do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1091
</IRQ>
do_softirq.part.0+0x11a/0x170 kernel/softirq.c:336
do_softirq kernel/softirq.c:328 [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:721 [inline]
ip6_finish_output2+0xbd2/0x2560 net/ipv6/ip6_output.c:121
ip6_finish_output+0x574/0xbe0 net/ipv6/ip6_output.c:154
NF_HOOK_COND include/linux/netfilter.h:278 [inline]
ip6_output+0x235/0x7c0 net/ipv6/ip6_output.c:171
dst_output include/net/dst.h:447 [inline]
NF_HOOK include/linux/netfilter.h:289 [inline]
NF_HOOK include/linux/netfilter.h:283 [inline]
ip6_xmit+0xe44/0x2030 net/ipv6/ip6_output.c:275
inet6_csk_xmit+0x2fb/0x5ba net/ipv6/inet6_connection_sock.c:139
__tcp_transmit_skb+0x1ae1/0x39f0 net/ipv4/tcp_output.c:1146
tcp_transmit_skb net/ipv4/tcp_output.c:1162 [inline]
tcp_write_xmit+0x142a/0x5230 net/ipv4/tcp_output.c:2387
__tcp_push_pending_frames+0xb4/0x280 net/ipv4/tcp_output.c:2563
tcp_send_fin+0x153/0xc40 net/ipv4/tcp_output.c:3107
tcp_close+0xdcd/0x10a0 net/ipv4/tcp.c:2412
inet_release+0xff/0x1e0 net/ipv4/af_inet.c:428
inet6_release+0x53/0x80 net/ipv6/af_inet6.c:472
__sock_release+0xce/0x2a0 net/socket.c:579
sock_close+0x1b/0x30 net/socket.c:1140
__fput+0x2dd/0x8b0 fs/file_table.c:278
____fput+0x16/0x20 fs/file_table.c:309
task_work_run+0x145/0x1c0 kernel/task_work.c:113
get_signal+0x1baa/0x1fc0 kernel/signal.c:2389
do_signal+0x95/0x1960 arch/x86/kernel/signal.c:821
exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:163
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45af49
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:00007ff5d57b8c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002d
RAX: fffffffffffffe00 RBX: 0000000000000006 RCX: 000000000045af49
RDX: 000000000000001c RSI: 00000000200001c0 RDI: 0000000000000005
RBP: 000000000075bfc8 R08: 0000000020001880 R09: 000000000000001c
R10: 0000000000000100 R11: 0000000000000246 R12: 00007ff5d57b96d4
R13: 00000000004c978a R14: 00000000004e2450 R15: 00000000ffffffff

Allocated by task 8130:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
kasan_kmalloc mm/kasan/kasan.c:553 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
__do_kmalloc mm/slab.c:3727 [inline]
__kmalloc+0x15d/0x750 mm/slab.c:3736
kmalloc_array include/linux/slab.h:637 [inline]
kcalloc include/linux/slab.h:648 [inline]
tcp_cdg_init+0x11f/0x180 net/ipv4/tcp_cdg.c:379
tcp_init_congestion_control+0xac/0x450 net/ipv4/tcp_cong.c:182
tcp_reinit_congestion_control+0xd1/0x100 net/ipv4/tcp_cong.c:200
tcp_set_congestion_control+0x46d/0x570 net/ipv4/tcp_cong.c:377
do_tcp_setsockopt.isra.0+0x41f/0x23a0 net/ipv4/tcp.c:2745
tcp_setsockopt+0xbe/0xe0 net/ipv4/tcp.c:3079
sock_common_setsockopt+0x94/0xd0 net/core/sock.c:3046
__sys_setsockopt+0x17a/0x280 net/socket.c:1901
__do_sys_setsockopt net/socket.c:1912 [inline]
__se_sys_setsockopt net/socket.c:1909 [inline]
__x64_sys_setsockopt+0xbe/0x150 net/socket.c:1909
do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8190:
save_stack+0x45/0xd0 mm/kasan/kasan.c:448
set_track mm/kasan/kasan.c:460 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
__cache_free mm/slab.c:3503 [inline]
kfree+0xcf/0x220 mm/slab.c:3822
tcp_cdg_release+0x37/0x50 net/ipv4/tcp_cdg.c:389
tcp_cleanup_congestion_control+0x71/0x100 net/ipv4/tcp_cong.c:209
tcp_v4_destroy_sock+0xff/0x7d0 net/ipv4/tcp_ipv4.c:1972
tcp_v6_destroy_sock+0x16/0x30 net/ipv6/tcp_ipv6.c:1763
inet_csk_destroy_sock+0x19a/0x420 net/ipv4/inet_connection_sock.c:838
tcp_close+0xa58/0x10a0 net/ipv4/tcp.c:2487
inet_release+0xff/0x1e0 net/ipv4/af_inet.c:428
inet6_release+0x53/0x80 net/ipv6/af_inet6.c:472
__sock_release+0xce/0x2a0 net/socket.c:579
sock_close+0x1b/0x30 net/socket.c:1140
__fput+0x2dd/0x8b0 fs/file_table.c:278
____fput+0x16/0x20 fs/file_table.c:309
task_work_run+0x145/0x1c0 kernel/task_work.c:113
get_signal+0x1baa/0x1fc0 kernel/signal.c:2389
do_signal+0x95/0x1960 arch/x86/kernel/signal.c:821
exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:163
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809f328a80
which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
64-byte region [ffff88809f328a80, ffff88809f328ac0)
The buggy address belongs to the page:
page:ffffea00027cca00 count:1 mapcount:0 mapping:ffff88812c31c340 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea00027cc308 ffffea0002a5e808 ffff88812c31c340
raw: 0000000000000000 ffff88809f328000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88809f328980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88809f328a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
> ffff88809f328a80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
^
ffff88809f328b00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff88809f328b80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
May 10, 2020, 11:44:09 PM5/10/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages