syzbot


KASAN: use-after-free Read in tcp_init_tso_segs

Status: public: reported C repro on 2019/09/10 11:54
Reported-by: syzbot+d1ee6e290c1891301c16@syzkaller.appspotmail.com
First crash: 1918d, last: 1906d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in tcp_init_tso_segs C 1424 1907d 1918d 1/1 fixed on 2019/10/04 12:05
android-44 KASAN: use-after-free Read in tcp_init_tso_segs 1 2110d 2067d 0/2 auto-closed as invalid on 2019/08/29 08:15

Sample crash report:
audit: type=1400 audit(1569088068.106:7): avc:  denied  { map } for  pid=1789 comm="syz-executor280" path="/root/syz-executor280505764" dev="sda1" ino=16482 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: use-after-free in tcp_skb_pcount include/net/tcp.h:912 [inline]
BUG: KASAN: use-after-free in tcp_init_tso_segs+0x19d/0x1f0 net/ipv4/tcp_output.c:1790
Read of size 2 at addr ffff8881d6fb5430 by task syz-executor280/1790

CPU: 0 PID: 1790 Comm: syz-executor280 Not tainted 4.14.145+ #0
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xca/0x134 lib/dump_stack.c:53
 print_address_description+0x60/0x226 mm/kasan/report.c:187
 __kasan_report.cold+0x1a/0x41 mm/kasan/report.c:316
 tcp_skb_pcount include/net/tcp.h:912 [inline]
 tcp_init_tso_segs+0x19d/0x1f0 net/ipv4/tcp_output.c:1790
 tcp_write_xmit+0x15a/0x4730 net/ipv4/tcp_output.c:2330
 __tcp_push_pending_frames+0xa0/0x230 net/ipv4/tcp_output.c:2563
 tcp_send_fin+0x154/0xbc0 net/ipv4/tcp_output.c:3115
 tcp_close+0xc62/0xf40 net/ipv4/tcp.c:2221
 inet_release+0xe9/0x1c0 net/ipv4/af_inet.c:423
 __sock_release+0xd2/0x2c0 net/socket.c:602
 sock_close+0x15/0x20 net/socket.c:1139
 __fput+0x25e/0x710 fs/file_table.c:210
 task_work_run+0x125/0x1a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9cb/0x2a20 kernel/exit.c:875
 do_group_exit+0x100/0x2e0 kernel/exit.c:978
 SYSC_exit_group kernel/exit.c:989 [inline]
 SyS_exit_group+0x19/0x20 kernel/exit.c:987
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x440b38
RSP: 002b:00007ffe01a9f9e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 0000000000440b38
RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
RBP: 00000000004c6fd0 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000020000804 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d95e0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 1790:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc.part.0+0x53/0xc0 mm/kasan/common.c:495
 slab_post_alloc_hook mm/slab.h:439 [inline]
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2800 [inline]
 kmem_cache_alloc+0xee/0x360 mm/slub.c:2805
 kmem_cache_alloc_node include/linux/slab.h:361 [inline]
 __alloc_skb+0xea/0x5c0 net/core/skbuff.c:193
 alloc_skb_fclone include/linux/skbuff.h:1022 [inline]
 sk_stream_alloc_skb+0xf4/0x8a0 net/ipv4/tcp.c:855
 tcp_sendmsg_locked+0xf11/0x2f50 net/ipv4/tcp.c:1301
 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
 inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb7/0x100 net/socket.c:656
 SYSC_sendto net/socket.c:1763 [inline]
 SyS_sendto+0x1de/0x2f0 net/socket.c:1731
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
 0xffffffffffffffff

Freed by task 1790:
 save_stack mm/kasan/common.c:76 [inline]
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x164/0x210 mm/kasan/common.c:457
 slab_free_hook mm/slub.c:1407 [inline]
 slab_free_freelist_hook mm/slub.c:1458 [inline]
 slab_free mm/slub.c:3039 [inline]
 kmem_cache_free+0xd7/0x3b0 mm/slub.c:3055
 kfree_skbmem+0x84/0x110 net/core/skbuff.c:607
 sk_wmem_free_skb include/net/sock.h:1416 [inline]
 tcp_remove_empty_skb net/ipv4/tcp.c:929 [inline]
 tcp_remove_empty_skb+0x264/0x320 net/ipv4/tcp.c:923
 tcp_sendmsg_locked+0x1c09/0x2f50 net/ipv4/tcp.c:1435
 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
 inet_sendmsg+0x15b/0x520 net/ipv4/af_inet.c:760
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb7/0x100 net/socket.c:656
 SYSC_sendto net/socket.c:1763 [inline]
 SyS_sendto+0x1de/0x2f0 net/socket.c:1731
 do_syscall_64+0x19b/0x520 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
 0xffffffffffffffff

The buggy address belongs to the object at ffff8881d6fb5400
 which belongs to the cache skbuff_fclone_cache of size 456
The buggy address is located 48 bytes inside of
 456-byte region [ffff8881d6fb5400, ffff8881d6fb55c8)
The buggy address belongs to the page:
page:ffffea00075bed00 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 0000000000000000 0000000000000000 00000001800c000c
raw: dead000000000100 dead000000000200 ffff8881dab70400 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d6fb5300: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc
 ffff8881d6fb5380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881d6fb5400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff8881d6fb5480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881d6fb5500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1131):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/09/21 17:50 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 17:28 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 17:10 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 16:39 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 16:20 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 16:16 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 15:57 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 15:20 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 14:59 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 14:25 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 13:59 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 13:35 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 13:15 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 12:59 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 12:25 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 12:03 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 11:42 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 11:07 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 10:31 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 10:01 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 09:24 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 09:05 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 08:40 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 08:17 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 07:55 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 07:08 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 06:45 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 06:22 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 05:49 android-4.14 a9e9acce73d4 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 03:53 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 02:55 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 02:54 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 01:38 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 01:12 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 00:48 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 00:22 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 00:09 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/20 23:39 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/20 23:31 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/20 23:16 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/20 22:55 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/20 22:29 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/20 22:05 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/20 21:27 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/20 20:59 android-4.14 61a760424681 d96e88f3 .config console log report syz C ci-android-414-kasan-gce-root
2019/09/10 13:50 android-4.14 f02af7b02c26 a60cb4cd .config console log report syz C ci-android-414-kasan-gce-root
2019/09/21 02:12 android-4.14 61a760424681 d96e88f3 .config console log report syz ci-android-414-kasan-gce-root
2019/09/21 10:49 android-4.14 a9e9acce73d4 d96e88f3 .config console log report ci-android-414-kasan-gce-root
2019/09/21 05:12 android-4.14 a9e9acce73d4 d96e88f3 .config console log report ci-android-414-kasan-gce-root
2019/09/21 03:51 android-4.14 61a760424681 d96e88f3 .config console log report ci-android-414-kasan-gce-root
2019/09/20 23:46 android-4.14 61a760424681 d96e88f3 .config console log report ci-android-414-kasan-gce-root
2019/09/20 15:52 android-4.14 61a760424681 d96e88f3 .config console log report ci-android-414-kasan-gce-root
2019/09/20 10:52 android-4.14 290dd9dfcbe8 d96e88f3 .config console log report ci-android-414-kasan-gce-root
2019/09/20 08:34 android-4.14 290dd9dfcbe8 4d3ae0b7 .config console log report ci-android-414-kasan-gce-root
2019/09/19 23:00 android-4.14 290dd9dfcbe8 4d3ae0b7 .config console log report ci-android-414-kasan-gce-root
2019/09/19 14:32 android-4.14 290dd9dfcbe8 eb940044 .config console log report ci-android-414-kasan-gce-root
2019/09/19 11:42 android-4.14 290dd9dfcbe8 eb940044 .config console log report ci-android-414-kasan-gce-root
2019/09/19 06:32 android-4.14 6bb0e9159cb6 46c0be24 .config console log report ci-android-414-kasan-gce-root
2019/09/19 00:45 android-4.14 6bb0e9159cb6 46c0be24 .config console log report ci-android-414-kasan-gce-root
2019/09/18 18:23 android-4.14 6bb0e9159cb6 c2dcd700 .config console log report ci-android-414-kasan-gce-root
2019/09/18 00:29 android-4.14 ca30356b2a26 03e0d245 .config console log report ci-android-414-kasan-gce-root
2019/09/17 23:02 android-4.14 ca30356b2a26 13dcda9b .config console log report ci-android-414-kasan-gce-root
2019/09/17 19:04 android-4.14 ca30356b2a26 13dcda9b .config console log report ci-android-414-kasan-gce-root
2019/09/17 13:54 android-4.14 ca30356b2a26 13dcda9b .config console log report ci-android-414-kasan-gce-root
2019/09/17 02:29 android-4.14 5d41eafc92c2 51ca0454 .config console log report ci-android-414-kasan-gce-root
2019/09/16 16:44 android-4.14 911452d91654 cb936299 .config console log report ci-android-414-kasan-gce-root
2019/09/16 11:04 android-4.14 911452d91654 cb936299 .config console log report ci-android-414-kasan-gce-root
2019/09/16 05:31 android-4.14 f02af7b02c26 32d59357 .config console log report ci-android-414-kasan-gce-root
2019/09/15 01:52 android-4.14 f02af7b02c26 32d59357 .config console log report ci-android-414-kasan-gce-root
2019/09/14 15:29 android-4.14 f02af7b02c26 32d59357 .config console log report ci-android-414-kasan-gce-root
2019/09/14 12:47 android-4.14 f02af7b02c26 32d59357 .config console log report ci-android-414-kasan-gce-root
2019/09/13 20:00 android-4.14 f02af7b02c26 32d59357 .config console log report ci-android-414-kasan-gce-root
2019/09/13 18:36 android-4.14 f02af7b02c26 40fa42bc .config console log report ci-android-414-kasan-gce-root
2019/09/13 16:32 android-4.14 f02af7b02c26 40fa42bc .config console log report ci-android-414-kasan-gce-root
2019/09/13 13:48 android-4.14 f02af7b02c26 40fa42bc .config console log report ci-android-414-kasan-gce-root
2019/09/13 09:04 android-4.14 f02af7b02c26 40fa42bc .config console log report ci-android-414-kasan-gce-root
2019/09/13 02:20 android-4.14 f02af7b02c26 40fa42bc .config console log report ci-android-414-kasan-gce-root
2019/09/12 20:40 android-4.14 f02af7b02c26 0b7672ee .config console log report ci-android-414-kasan-gce-root
2019/09/12 16:59 android-4.14 f02af7b02c26 0b7672ee .config console log report ci-android-414-kasan-gce-root
2019/09/12 14:17 android-4.14 f02af7b02c26 0b7672ee .config console log report ci-android-414-kasan-gce-root
2019/09/11 21:29 android-4.14 f02af7b02c26 f4e53c10 .config console log report ci-android-414-kasan-gce-root
2019/09/10 20:50 android-4.14 f02af7b02c26 a60cb4cd .config console log report ci-android-414-kasan-gce-root
2019/09/10 20:36 android-4.14 f02af7b02c26 a60cb4cd .config console log report ci-android-414-kasan-gce-root
2019/09/10 20:13 android-4.14 f02af7b02c26 a60cb4cd .config console log report ci-android-414-kasan-gce-root
2019/09/10 17:55 android-4.14 f02af7b02c26 a60cb4cd .config console log report ci-android-414-kasan-gce-root
2019/09/10 17:37 android-4.14 f02af7b02c26 a60cb4cd .config console log report ci-android-414-kasan-gce-root
2019/09/10 13:08 android-4.14 f02af7b02c26 a60cb4cd .config console log report ci-android-414-kasan-gce-root
2019/09/10 11:41 android-4.14 f02af7b02c26 a60cb4cd .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.