syzbot


KASAN: use-after-free Read in tcp_connect

Status: public: reported C repro on 2019/04/11 08:44
Reported-by: syzbot+75ab688fd052f6ffbefd@syzkaller.appspotmail.com
First crash: 2371d, last: 1838d

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): veth1: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1: link becomes ready
ip (4106) used greatest stack depth: 23544 bytes left
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
==================================================================
BUG: KASAN: use-after-free in tcp_connect+0x2633/0x2fa0 net/ipv4/tcp_output.c:3401
Read of size 4 at addr ffff8801da394a28 by task syz-executor787/4171

CPU: 0 PID: 4171 Comm: syz-executor787 Not tainted 4.9.107-g42a730a #48
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801d6c47930 ffffffff81eb42a9 ffffea000768e500 ffff8801da394a28
 0000000000000000 ffff8801da394a28 ffff8801b87b9c18 ffff8801d6c47968
 ffffffff81567f09 ffff8801da394a28 0000000000000004 0000000000000000
Call Trace:
 [<ffffffff81eb42a9>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81eb42a9>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff81567f09>] print_address_description+0x6c/0x234 mm/kasan/report.c:256
 [<ffffffff81568313>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<ffffffff81568313>] kasan_report.cold.6+0x242/0x2fe mm/kasan/report.c:412
 [<ffffffff8153bf44>] __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 [<ffffffff833ae1f3>] tcp_connect+0x2633/0x2fa0 net/ipv4/tcp_output.c:3401
 [<ffffffff833c3e60>] tcp_v4_connect+0x19f0/0x1c20 net/ipv4/tcp_ipv4.c:250
 [<ffffffff83422980>] __inet_stream_connect+0x6e0/0xbf0 net/ipv4/af_inet.c:627
 [<ffffffff83422ee5>] inet_stream_connect+0x55/0xa0 net/ipv4/af_inet.c:691
 [<ffffffff83017958>] SYSC_connect+0x1b8/0x300 net/socket.c:1562
 [<ffffffff8301a224>] SyS_connect+0x24/0x30 net/socket.c:1543
 [<ffffffff81006316>] do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 [<ffffffff839f9b13>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Allocated by task 4171:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:609
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:547
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 kmem_cache_alloc+0xbe/0x290 mm/slub.c:2728
 kmem_cache_alloc_node include/linux/slab.h:364 [inline]
 __alloc_skb+0xe6/0x600 net/core/skbuff.c:219
 alloc_skb_fclone include/linux/skbuff.h:961 [inline]
 sk_stream_alloc_skb+0xa3/0x5d0 net/ipv4/tcp.c:828
 tcp_sendmsg+0xe57/0x3040 net/ipv4/tcp.c:1230
 inet_sendmsg+0x203/0x4d0 net/ipv4/af_inet.c:770
 sock_sendmsg_nosec net/socket.c:635 [inline]
 sock_sendmsg+0xcc/0x110 net/socket.c:645
 SYSC_sendto+0x21c/0x370 net/socket.c:1670
 SyS_sendto+0x40/0x50 net/socket.c:1638
 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 4171:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:582
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kmem_cache_free+0xbe/0x310 mm/slub.c:2980
 kfree_skbmem+0x7c/0x100 net/core/skbuff.c:644
 __kfree_skb+0x1d/0x20 net/core/skbuff.c:685
 sk_wmem_free_skb include/net/sock.h:1358 [inline]
 tcp_write_queue_purge include/net/tcp.h:1530 [inline]
 tcp_connect_init net/ipv4/tcp_output.c:3241 [inline]
 tcp_connect+0xaaf/0x2fa0 net/ipv4/tcp_output.c:3372
 tcp_v4_connect+0x19f0/0x1c20 net/ipv4/tcp_ipv4.c:250
 __inet_stream_connect+0x6e0/0xbf0 net/ipv4/af_inet.c:627
 inet_stream_connect+0x55/0xa0 net/ipv4/af_inet.c:691
 SYSC_connect+0x1b8/0x300 net/socket.c:1562
 SyS_connect+0x24/0x30 net/socket.c:1543
 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

The buggy address belongs to the object at ffff8801da394a00
 which belongs to the cache skbuff_fclone_cache of size 456
The buggy address is located 40 bytes inside of
 456-byte region [ffff8801da394a00, ffff8801da394bc8)
The buggy address belongs to the page:
page:ffffea000768e500 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x8000000000004080(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801da394900: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
 ffff8801da394980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801da394a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff8801da394a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801da394b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1478):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/06/07 17:58 https://android.googlesource.com/kernel/common android-4.9 42a730adb6e2 645e75f8 .config console log report syz C ci-android-49-kasan-gce
2018/06/01 23:26 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report syz C ci-android-49-kasan-gce-root
2018/06/01 20:03 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report syz C ci-android-49-kasan-gce
2018/05/26 04:46 https://android.googlesource.com/kernel/common android-4.9 70c65e471b71 f48c20b8 .config console log report syz C ci-android-49-kasan-gce
2018/05/26 04:45 https://android.googlesource.com/kernel/common android-4.9 70c65e471b71 f48c20b8 .config console log report syz C ci-android-49-kasan-gce-root
2018/05/26 04:28 https://android.googlesource.com/kernel/common android-4.9 70c65e471b71 f48c20b8 .config console log report syz C ci-android-49-kasan-gce-root
2018/05/26 04:14 https://android.googlesource.com/kernel/common android-4.9 70c65e471b71 f48c20b8 .config console log report syz C ci-android-49-kasan-gce
2018/11/24 03:56 https://android.googlesource.com/kernel/common android-4.9 f44ed2c9232d eb9ed731 .config console log report syz ci-android-49-kasan-gce-root
2018/11/19 20:48 https://android.googlesource.com/kernel/common android-4.9 109a48ed2f69 adf636a8 .config console log report syz ci-android-49-kasan-gce-root
2018/10/27 01:17 https://android.googlesource.com/kernel/common android-4.9 322089173588 a8292de9 .config console log report syz ci-android-49-kasan-gce-root
2018/10/27 00:57 https://android.googlesource.com/kernel/common android-4.9 322089173588 a8292de9 .config console log report syz ci-android-49-kasan-gce
2018/10/25 02:16 https://android.googlesource.com/kernel/common android-4.9 b8bd066f13f4 a8292de9 .config console log report syz ci-android-49-kasan-gce-root
2018/10/13 11:57 https://android.googlesource.com/kernel/common android-4.9 d589c0d40671 caf12900 .config console log report syz ci-android-49-kasan-gce-root
2018/10/07 02:13 https://android.googlesource.com/kernel/common android-4.9 7bebf33f9d46 8b311eaf .config console log report syz ci-android-49-kasan-gce-root
2018/10/27 00:56 https://android.googlesource.com/kernel/common android-4.9 322089173588 a8292de9 .config console log report syz ci-android-49-kasan-gce-386
2018/10/25 02:55 https://android.googlesource.com/kernel/common android-4.9 b8bd066f13f4 a8292de9 .config console log report syz ci-android-49-kasan-gce-386
2018/06/07 17:49 https://android.googlesource.com/kernel/common android-4.9 42a730adb6e2 645e75f8 .config console log report syz ci-android-49-kasan-gce-386
2018/06/01 20:00 https://android.googlesource.com/kernel/common android-4.9 d7e64f8022e4 2f93b54f .config console log report syz ci-android-49-kasan-gce-386
2018/05/26 04:44 https://android.googlesource.com/kernel/common android-4.9 70c65e471b71 f48c20b8 .config console log report syz ci-android-49-kasan-gce-386
2018/05/26 03:56 https://android.googlesource.com/kernel/common android-4.9 70c65e471b71 f48c20b8 .config console log report syz ci-android-49-kasan-gce-386
2019/08/07 12:44 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 cdde7486 .config console log report ci-android-49-kasan-gce
2019/07/30 05:09 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 f67095ee .config console log report ci-android-49-kasan-gce
2019/07/29 08:09 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 c85e1c5b .config console log report ci-android-49-kasan-gce
2019/06/29 17:24 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 7509bf36 .config console log report ci-android-49-kasan-gce
2019/06/28 15:08 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 7509bf36 .config console log report ci-android-49-kasan-gce
2019/06/27 12:39 https://android.googlesource.com/kernel/common android-4.9 a80a7ab5f7c3 7509bf36 .config console log report ci-android-49-kasan-gce-root
2019/06/26 14:51 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 4d342240 .config console log report ci-android-49-kasan-gce
2019/06/13 21:58 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 a139f92f .config console log report ci-android-49-kasan-gce
2019/06/12 01:03 https://android.googlesource.com/kernel/common android-4.9 e53fcdd909a9 ea2f4006 .config console log report ci-android-49-kasan-gce-root
2019/06/10 06:16 https://android.googlesource.com/kernel/common android-4.9 83ae225d5ce3 0159583c .config console log report ci-android-49-kasan-gce-root
2019/04/09 19:18 https://android.googlesource.com/kernel/common android-4.9 286f971000f1 995065ff .config console log report ci-android-49-kasan-gce-root
2019/04/09 17:29 https://android.googlesource.com/kernel/common android-4.9 286f971000f1 995065ff .config console log report ci-android-49-kasan-gce-root
2019/04/09 03:22 https://android.googlesource.com/kernel/common android-4.9 286f971000f1 995065ff .config console log report ci-android-49-kasan-gce-root
2019/04/08 09:16 https://android.googlesource.com/kernel/common android-4.9 286f971000f1 c34fde03 .config console log report ci-android-49-kasan-gce-root
2019/04/07 12:37 https://android.googlesource.com/kernel/common android-4.9 286f971000f1 c34fde03 .config console log report ci-android-49-kasan-gce-root
2019/04/07 01:09 https://android.googlesource.com/kernel/common android-4.9 286f971000f1 c34fde03 .config console log report ci-android-49-kasan-gce-root
2019/04/06 11:33 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 c34fde03 .config console log report ci-android-49-kasan-gce
2019/03/22 02:30 https://android.googlesource.com/kernel/common android-4.9 1597fdfe52ba dce6e62f .config console log report ci-android-49-kasan-gce-root
2019/03/14 13:58 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d09a902e .config console log report ci-android-49-kasan-gce
2019/03/09 06:44 https://android.googlesource.com/kernel/common android-4.9 1597fdfe52ba 12365b99 .config console log report ci-android-49-kasan-gce-root
2019/03/06 16:01 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 05cf83bf .config console log report ci-android-49-kasan-gce
2019/03/04 20:47 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 7c693b52 .config console log report ci-android-49-kasan-gce
2019/02/20 12:01 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 c95f0707 .config console log report ci-android-49-kasan-gce
2019/02/11 19:18 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 73f5f452 .config console log report ci-android-49-kasan-gce
2019/01/31 22:24 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 0e8ea0a3 .config console log report ci-android-49-kasan-gce
2019/11/10 07:13 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 dc438b91 .config console log report ci-android-49-kasan-gce-386
2019/08/28 15:28 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 fd37b39e .config console log report ci-android-49-kasan-gce-386
2019/08/27 00:34 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d21c5d9d .config console log report ci-android-49-kasan-gce-386
2019/07/24 22:28 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 32329ceb .config console log report ci-android-49-kasan-gce-386
2019/06/29 16:16 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 7509bf36 .config console log report ci-android-49-kasan-gce-386
2019/04/06 13:00 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 c34fde03 .config console log report ci-android-49-kasan-gce-386
2019/04/05 06:16 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 e5d1b3ac .config console log report ci-android-49-kasan-gce-386
2019/03/14 01:44 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 2881fc25 .config console log report ci-android-49-kasan-gce-386
2019/03/10 00:13 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 12365b99 .config console log report ci-android-49-kasan-gce-386
2019/03/09 04:04 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 12365b99 .config console log report ci-android-49-kasan-gce-386
2019/03/08 02:01 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 4b69c3cb .config console log report ci-android-49-kasan-gce-386
2019/03/05 21:22 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 16559f86 .config console log report ci-android-49-kasan-gce-386
2019/03/04 21:59 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 7c693b52 .config console log report ci-android-49-kasan-gce-386
2019/03/04 15:16 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 7c693b52 .config console log report ci-android-49-kasan-gce-386
2019/03/03 10:02 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1c0e457a .config console log report ci-android-49-kasan-gce-386
2019/03/02 16:43 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1c0e457a .config console log report ci-android-49-kasan-gce-386
2019/03/02 08:35 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1c0e457a .config console log report ci-android-49-kasan-gce-386
2019/02/21 06:48 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 c95f0707 .config console log report ci-android-49-kasan-gce-386
2019/02/13 13:52 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1eedba36 .config console log report ci-android-49-kasan-gce-386
2019/02/13 05:09 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 1eedba36 .config console log report ci-android-49-kasan-gce-386
2019/02/09 13:28 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 fa6c7b70 .config console log report ci-android-49-kasan-gce-386
2019/02/06 18:50 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 d25487bc .config console log report ci-android-49-kasan-gce-386
2019/02/04 03:17 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 c198d5dd .config console log report ci-android-49-kasan-gce-386
2019/02/02 04:34 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 564f9a4f .config console log report ci-android-49-kasan-gce-386
2019/02/01 17:51 https://android.googlesource.com/kernel/common android-4.9 8fe428403e30 0c07abcf .config console log report ci-android-49-kasan-gce-386
* Struck through repros no longer work on HEAD.