syzbot


KASAN: use-after-free Read in tcp_init_tso_segs

Status: fixed on 2019/10/04 12:05
Reported-by: syzbot+14330efdeec0df0b4c01@syzkaller.appspotmail.com
Fix commit: f1dcc5ed4bea tcp: Reset send_head when removing skb from write-queue
First crash: 1246d, last: 1235d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-44 KASAN: use-after-free Read in tcp_init_tso_segs 1 1438d 1395d 0/2 auto-closed as invalid on 2019/08/29 08:15
android-414 KASAN: use-after-free Read in tcp_init_tso_segs C 1131 1234d 1245d 0/1 public: reported C repro on 2019/09/10 11:54

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): hsr0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): team0: link becomes ready
IPv6: ADDRCONF(NETDEV_UP): vxcan1: link is not ready
8021q: adding VLAN 0 to HW filter on device batadv0
==================================================================
BUG: KASAN: use-after-free in tcp_skb_pcount include/net/tcp.h:911 [inline]
BUG: KASAN: use-after-free in tcp_init_tso_segs+0x1ae/0x200 net/ipv4/tcp_output.c:1790
Read of size 2 at addr ffff888081814330 by task syz-executor314/6858

CPU: 0 PID: 6858 Comm: syz-executor314 Not tainted 4.14.145 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x197 lib/dump_stack.c:53
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_load2_noabort+0x14/0x20 mm/kasan/report.c:428
 tcp_skb_pcount include/net/tcp.h:911 [inline]
 tcp_init_tso_segs+0x1ae/0x200 net/ipv4/tcp_output.c:1790
 tcp_write_xmit+0x15e/0x4960 net/ipv4/tcp_output.c:2330
 __tcp_push_pending_frames+0xa6/0x260 net/ipv4/tcp_output.c:2563
 tcp_send_fin+0x17e/0xc40 net/ipv4/tcp_output.c:3115
 tcp_close+0xcc8/0xfb0 net/ipv4/tcp.c:2221
 inet_release+0xec/0x1c0 net/ipv4/af_inet.c:425
 __sock_release+0xce/0x2b0 net/socket.c:602
 sock_close+0x1b/0x30 net/socket.c:1139
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x7df/0x2c10 kernel/exit.c:874
 do_group_exit+0x111/0x330 kernel/exit.c:977
 SYSC_exit_group kernel/exit.c:988 [inline]
 SyS_exit_group+0x1d/0x20 kernel/exit.c:986
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x440618
RSP: 002b:00007ffca8db1a88 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 0000000000440618
RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
RBP: 00000000004c6970 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000020000800 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d95e0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6858:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc_node+0x144/0x780 mm/slab.c:3642
 __alloc_skb+0x9c/0x500 net/core/skbuff.c:193
 alloc_skb_fclone include/linux/skbuff.h:1022 [inline]
 sk_stream_alloc_skb+0xb3/0x780 net/ipv4/tcp.c:855
 tcp_sendmsg_locked+0xf61/0x3200 net/ipv4/tcp.c:1301
 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1457
 inet_sendmsg+0x122/0x500 net/ipv4/af_inet.c:762
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xce/0x110 net/socket.c:656
 SYSC_sendto+0x206/0x310 net/socket.c:1763
 SyS_sendto+0x40/0x50 net/socket.c:1731
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 6858:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
 kfree_skbmem+0x8d/0x120 net/core/skbuff.c:607
 __kfree_skb+0x1e/0x30 net/core/skbuff.c:646
 sk_wmem_free_skb include/net/sock.h:1416 [inline]
 tcp_remove_empty_skb.part.0+0x231/0x2e0 net/ipv4/tcp.c:929
 tcp_remove_empty_skb net/ipv4/tcp.c:925 [inline]
 tcp_sendmsg_locked+0x1ced/0x3200 net/ipv4/tcp.c:1435
 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1457
 inet_sendmsg+0x122/0x500 net/ipv4/af_inet.c:762
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xce/0x110 net/socket.c:656
 SYSC_sendto+0x206/0x310 net/socket.c:1763
 SyS_sendto+0x40/0x50 net/socket.c:1731
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff888081814300
 which belongs to the cache skbuff_fclone_cache of size 472
The buggy address is located 48 bytes inside of
 472-byte region [ffff888081814300, ffff8880818144d8)
The buggy address belongs to the page:
page:ffffea0002060500 count:1 mapcount:0 mapping:ffff888081814080 index:0x0
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff888081814080 0000000000000000 0000000100000006
raw: ffffea000264e960 ffffea00020162e0 ffff8880a9e19a80 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888081814200: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
 ffff888081814280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888081814300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff888081814380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888081814400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1424):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-linux-4-14 2019/09/21 05:31 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 05:04 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 04:39 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 04:34 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 04:13 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 03:54 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 03:29 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 02:49 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 02:32 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 02:17 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 01:52 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 01:28 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 01:00 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/21 00:12 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 23:55 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 23:50 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 23:23 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 23:01 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 22:49 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 22:31 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 22:08 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 21:32 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 21:10 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 20:46 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 20:04 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 19:42 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 19:15 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 18:40 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 18:16 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 18:09 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 17:48 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 17:01 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 16:38 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 16:13 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 15:48 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 15:21 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 15:01 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 14:38 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/20 13:49 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz C
ci2-linux-4-14 2019/09/10 14:01 linux-4.14.y e2cd24b62938 a60cb4cd .config console log report syz C
ci2-linux-4-14 2019/09/21 04:06 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz
ci2-linux-4-14 2019/09/21 03:23 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report syz
ci2-linux-4-14 2019/09/21 05:21 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report
ci2-linux-4-14 2019/09/20 22:53 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report
ci2-linux-4-14 2019/09/20 15:07 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report
ci2-linux-4-14 2019/09/20 14:13 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report
ci2-linux-4-14 2019/09/20 12:15 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report
ci2-linux-4-14 2019/09/20 10:50 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report
ci2-linux-4-14 2019/09/20 09:28 linux-4.14.y b10ab5e2c476 d96e88f3 .config console log report
ci2-linux-4-14 2019/09/20 06:43 linux-4.14.y b10ab5e2c476 4d3ae0b7 .config console log report
ci2-linux-4-14 2019/09/20 00:23 linux-4.14.y b10ab5e2c476 4d3ae0b7 .config console log report
ci2-linux-4-14 2019/09/19 21:54 linux-4.14.y b10ab5e2c476 4d3ae0b7 .config console log report
ci2-linux-4-14 2019/09/19 19:19 linux-4.14.y b10ab5e2c476 eb940044 .config console log report
ci2-linux-4-14 2019/09/19 15:06 linux-4.14.y b10ab5e2c476 eb940044 .config console log report
ci2-linux-4-14 2019/09/19 12:46 linux-4.14.y b10ab5e2c476 eb940044 .config console log report
ci2-linux-4-14 2019/09/19 09:33 linux-4.14.y b10ab5e2c476 eb940044 .config console log report
ci2-linux-4-14 2019/09/19 09:09 linux-4.14.y b10ab5e2c476 eb940044 .config console log report
ci2-linux-4-14 2019/09/19 02:34 linux-4.14.y 968722f5371a 46c0be24 .config console log report
ci2-linux-4-14 2019/09/18 19:44 linux-4.14.y 968722f5371a 46c0be24 .config console log report
ci2-linux-4-14 2019/09/18 17:09 linux-4.14.y 968722f5371a 46c0be24 .config console log report
ci2-linux-4-14 2019/09/18 15:41 linux-4.14.y 968722f5371a 1037b424 .config console log report
ci2-linux-4-14 2019/09/18 13:30 linux-4.14.y 968722f5371a 1037b424 .config console log report
ci2-linux-4-14 2019/09/18 12:18 linux-4.14.y 968722f5371a c2dcd700 .config console log report
ci2-linux-4-14 2019/09/18 08:33 linux-4.14.y 968722f5371a 03e0d245 .config console log report
ci2-linux-4-14 2019/09/18 00:31 linux-4.14.y 968722f5371a 03e0d245 .config console log report
ci2-linux-4-14 2019/09/17 22:50 linux-4.14.y 968722f5371a 13dcda9b .config console log report
ci2-linux-4-14 2019/09/17 19:35 linux-4.14.y 968722f5371a 13dcda9b .config console log report
ci2-linux-4-14 2019/09/17 15:11 linux-4.14.y 968722f5371a 13dcda9b .config console log report
ci2-linux-4-14 2019/09/17 12:09 linux-4.14.y 968722f5371a 13dcda9b .config console log report
ci2-linux-4-14 2019/09/16 22:08 linux-4.14.y 968722f5371a 51ca0454 .config console log report
ci2-linux-4-14 2019/09/16 20:49 linux-4.14.y 968722f5371a 51ca0454 .config console log report
ci2-linux-4-14 2019/09/16 09:41 linux-4.14.y 968722f5371a 55c50e70 .config console log report
ci2-linux-4-14 2019/09/16 08:00 linux-4.14.y 968722f5371a 55c50e70 .config console log report
ci2-linux-4-14 2019/09/16 06:39 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/15 18:35 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/15 15:28 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/15 09:21 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/15 03:30 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/14 19:04 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/14 07:29 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/14 02:55 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/13 22:04 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/13 16:25 linux-4.14.y e2cd24b62938 32d59357 .config console log report
ci2-linux-4-14 2019/09/10 11:22 linux-4.14.y e2cd24b62938 a60cb4cd .config console log report
* Struck through repros no longer work on HEAD.