syzbot


KASAN: use-after-free Read in tls_write_space

Status: closed as dup on 2019/08/19 21:22
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+2134b6b74dec9f8c760f@syzkaller.appspotmail.com
First crash: 2336d, last: 1936d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
general protection fault in tls_write_space net syz 33 1922d 1933d
Discussions (2)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in tls_write_space 1 (3) 2019/08/19 21:22
Reminder: 17 open syzbot bugs in "net/tls" subsystem 1 (1) 2019/06/25 05:50
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in tls_write_space C error 283 884d 2037d 0/1 upstream: reported C repro on 2019/04/26 18:51
linux-4.19 KASAN: use-after-free Read in tls_write_space C done 25 1424d 2049d 1/1 fixed on 2021/01/29 07:30

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in tls_write_space+0x150/0x170 net/tls/tls_main.c:239
Read of size 1 at addr ffff88809ae08938 by task syz-executor244/8895

CPU: 1 PID: 8895 Comm: syz-executor244 Not tainted 5.1.0+ #19
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:188
 __kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 kasan_report+0x12/0x20 mm/kasan/common.c:614
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/generic_report.c:129
 tls_write_space+0x150/0x170 net/tls/tls_main.c:239
 tcp_new_space net/ipv4/tcp_input.c:5131 [inline]
 tcp_check_space+0x430/0x720 net/ipv4/tcp_input.c:5142
 tcp_data_snd_check net/ipv4/tcp_input.c:5152 [inline]
 tcp_rcv_established+0x98f/0x1fa0 net/ipv4/tcp_input.c:5643
 tcp_v6_do_rcv+0x41e/0x12c0 net/ipv6/tcp_ipv6.c:1338
 sk_backlog_rcv include/net/sock.h:950 [inline]
 __release_sock+0x129/0x390 net/core/sock.c:2418
 release_sock+0x59/0x1c0 net/core/sock.c:2934
 tls_sk_proto_close+0x40b/0x770 net/tls/tls_main.c:312
 inet_release+0xff/0x1e0 net/ipv4/af_inet.c:432
 inet6_release+0x53/0x80 net/ipv6/af_inet6.c:474
 __sock_release+0xce/0x2a0 net/socket.c:607
 sock_close+0x1b/0x30 net/socket.c:1279
 __fput+0x2ff/0x890 fs/file_table.c:279
 ____fput+0x16/0x20 fs/file_table.c:312
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:168
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:279 [inline]
 do_syscall_64+0x58e/0x680 arch/x86/entry/common.c:304
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4020b0
Code: 01 f0 ff ff 0f 83 40 0d 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 83 3d 7d 8a 2d 00 00 75 14 b8 03 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 14 0d 00 00 c3 48 83 ec 08 e8 7a 02 00 00
RSP: 002b:00007fff217d0578 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000005 RCX: 00000000004020b0
RDX: 0000000000000000 RSI: 00000000200005c0 RDI: 0000000000000004
RBP: 0000000000012dfb R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000040 R11: 0000000000000246 R12: 0000000000403250
R13: 00000000004032e0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8895:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_kmalloc mm/kasan/common.c:489 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:462
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:503
 kmem_cache_alloc_trace+0x151/0x750 mm/slab.c:3555
 kmalloc include/linux/slab.h:547 [inline]
 kzalloc include/linux/slab.h:742 [inline]
 create_ctx+0x46/0x1f0 net/tls/tls_main.c:601
 tls_init net/tls/tls_main.c:787 [inline]
 tls_init+0x11d/0x510 net/tls/tls_main.c:769
 __tcp_set_ulp net/ipv4/tcp_ulp.c:125 [inline]
 tcp_set_ulp+0x330/0x640 net/ipv4/tcp_ulp.c:146
 do_tcp_setsockopt.isra.0+0x321/0x2320 net/ipv4/tcp.c:2788
 tcp_setsockopt+0xbe/0xe0 net/ipv4/tcp.c:3102
 sock_common_setsockopt+0x94/0xd0 net/core/sock.c:3130
 __sys_setsockopt+0x17a/0x280 net/socket.c:2078
 __do_sys_setsockopt net/socket.c:2089 [inline]
 __se_sys_setsockopt net/socket.c:2086 [inline]
 __x64_sys_setsockopt+0xbe/0x150 net/socket.c:2086
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8895:
 save_stack+0x23/0x90 mm/kasan/common.c:71
 set_track mm/kasan/common.c:79 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:451
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:459
 __cache_free mm/slab.c:3432 [inline]
 kfree+0xcf/0x220 mm/slab.c:3755
 tls_ctx_free.part.0+0x34/0x40 net/tls/tls_main.c:261
 tls_ctx_free net/tls/tls_main.c:256 [inline]
 tls_sk_proto_close+0x3fe/0x770 net/tls/tls_main.c:307
 inet_release+0xff/0x1e0 net/ipv4/af_inet.c:432
 inet6_release+0x53/0x80 net/ipv6/af_inet6.c:474
 __sock_release+0xce/0x2a0 net/socket.c:607
 sock_close+0x1b/0x30 net/socket.c:1279
 __fput+0x2ff/0x890 fs/file_table.c:279
 ____fput+0x16/0x20 fs/file_table.c:312
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:168
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:279 [inline]
 do_syscall_64+0x58e/0x680 arch/x86/entry/common.c:304
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809ae08840
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 248 bytes inside of
 512-byte region [ffff88809ae08840, ffff88809ae08a40)
The buggy address belongs to the page:
page:ffffea00026b8200 refcount:1 mapcount:0 mapping:ffff8880aa400940 index:0x0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea00026b7e08 ffffea0002a4dc08 ffff8880aa400940
raw: 0000000000000000 ffff88809ae080c0 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809ae08800: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff88809ae08880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809ae08900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff88809ae08980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809ae08a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (924):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/05/19 06:53 upstream 72cf0b07418a 5a4461b0 .config console log report syz C ci-upstream-kasan-gce
2019/05/18 23:37 upstream 72cf0b07418a 5a4461b0 .config console log report syz C ci-upstream-kasan-gce-selinux-root
2019/05/18 12:30 upstream 72cf0b07418a 5a4461b0 .config console log report syz C ci-upstream-kasan-gce-root
2018/07/09 21:30 upstream 1e4b044d2251 f25e5770 .config console log report syz C ci-upstream-kasan-gce
2018/10/20 18:07 upstream 270b77a0f30e ecb386fe .config console log report syz C ci-upstream-kasan-gce-386
2019/05/18 09:36 net-old 5a35c8ea7c40 5a4461b0 .config console log report syz C ci-upstream-net-this-kasan-gce
2018/07/09 00:32 net-old 6508b6781be0 f25e5770 .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/17 18:58 net-next-old 35c99ffa20ed 95dfd515 .config console log report syz C ci-upstream-net-kasan-gce
2018/09/22 16:53 net-next-old bd4d08daeb95 37079712 .config console log report syz C ci-upstream-net-kasan-gce
2018/09/22 16:12 net-next-old bd4d08daeb95 37079712 .config console log report syz C ci-upstream-net-kasan-gce
2018/09/22 14:54 net-next-old bd4d08daeb95 37079712 .config console log report syz C ci-upstream-net-kasan-gce
2018/09/22 11:46 net-next-old bd4d08daeb95 37079712 .config console log report syz C ci-upstream-net-kasan-gce
2018/07/08 23:54 net-next-old c47078d6a33f f25e5770 .config console log report syz C ci-upstream-net-kasan-gce
2019/05/18 06:43 linux-next b1d6682ef9bb 40046286 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/07/10 12:49 linux-next 3951bd9fe3e2 9fa03fa5 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/08/03 16:27 upstream 97b00aff2c45 6affd8e8 .config console log report syz ci-upstream-kasan-gce-selinux-root
2019/08/03 15:06 upstream 97b00aff2c45 6affd8e8 .config console log report syz ci-upstream-kasan-gce-smack-root
2019/01/24 02:42 upstream 30bac164aca7 56558f63 .config console log report syz ci-upstream-kasan-gce-386
2019/08/02 21:40 upstream 97b00aff2c45 6affd8e8 .config console log report ci-upstream-kasan-gce-selinux-root
2019/08/01 17:50 upstream 1e78030e5e5b 835dffe7 .config console log report ci-upstream-kasan-gce-root
2019/07/23 09:37 upstream c6dd78fcb8ee 55e0c077 .config console log report ci-upstream-kasan-gce-smack-root
2019/07/19 16:52 upstream 3bfe1fc46794 1656845f .config console log report ci-upstream-kasan-gce-root
2019/06/30 16:24 upstream 6fbc7275c7a9 7509bf36 .config console log report ci-upstream-kasan-gce
2019/06/28 22:57 upstream 556e2f6020bf 7509bf36 .config console log report ci-upstream-kasan-gce-selinux-root
2019/06/24 01:05 upstream 241e39004581 472f0082 .config console log report ci-upstream-kasan-gce
2019/06/23 12:15 upstream 241e39004581 3efccdd2 .config console log report ci-upstream-kasan-gce
2019/06/20 16:18 upstream abf02e2964b3 34bf9440 .config console log report ci-upstream-kasan-gce
2019/06/20 14:36 upstream abf02e2964b3 34bf9440 .config console log report ci-upstream-kasan-gce
2019/06/18 09:50 upstream 29f785ff76b6 442206d7 .config console log report ci-upstream-kasan-gce-root
2019/06/15 10:56 upstream 0011572c8830 442206d7 .config console log report ci-upstream-kasan-gce-selinux-root
2019/04/16 23:51 upstream 618d919cae2f 505ab413 .config console log report ci-upstream-kasan-gce-386
2019/08/05 03:41 net-old 107e47cc80ec 6affd8e8 .config console log report ci-upstream-net-this-kasan-gce
2019/07/30 16:06 net-old 107e47cc80ec f28bf2a5 .config console log report ci-upstream-net-this-kasan-gce
2019/07/25 20:34 net-old 107e47cc80ec 732bc5a0 .config console log report ci-upstream-net-this-kasan-gce
2019/07/24 14:33 net-old 107e47cc80ec 32329ceb .config console log report ci-upstream-net-this-kasan-gce
2019/07/24 12:47 net-old 107e47cc80ec 32329ceb .config console log report ci-upstream-net-this-kasan-gce
2019/07/22 05:57 net-old 107e47cc80ec b3c615f5 .config console log report ci-upstream-net-this-kasan-gce
2019/07/21 12:09 net-old 1a03bb532934 1656845f .config console log report ci-upstream-net-this-kasan-gce
2019/07/20 06:04 net-old 31cc088a4f5d 1656845f .config console log report ci-upstream-net-this-kasan-gce
2019/07/17 12:15 net-old a5b647007e9d 0d10349c .config console log report ci-upstream-net-this-kasan-gce
2019/06/30 04:08 net-old 8ec3ede55995 7509bf36 .config console log report ci-upstream-net-this-kasan-gce
2019/06/29 18:47 net-old 75dad2520fc3 7509bf36 .config console log report ci-upstream-net-this-kasan-gce
2019/06/26 07:27 net-old 904d88d743b0 0a8d1a96 .config console log report ci-upstream-net-this-kasan-gce
2019/06/24 10:54 net-old 85f9aa7565bd 472f0082 .config console log report ci-upstream-net-this-kasan-gce
2019/06/23 15:02 net-old 85f9aa7565bd 472f0082 .config console log report ci-upstream-net-this-kasan-gce
2019/06/16 04:24 net-old ef7bfa84725d 442206d7 .config console log report ci-upstream-net-this-kasan-gce
2019/06/16 02:26 net-old ef7bfa84725d 442206d7 .config console log report ci-upstream-net-this-kasan-gce
2019/06/15 20:20 net-old 35fc07aee8f6 442206d7 .config console log report ci-upstream-net-this-kasan-gce
2019/06/14 11:14 net-old b8003cef2e63 998ccc76 .config console log report ci-upstream-net-this-kasan-gce
2019/08/05 14:02 net-next-old 31cc088a4f5d 6affd8e8 .config console log report ci-upstream-net-kasan-gce
2019/08/03 04:47 net-next-old 31cc088a4f5d 6affd8e8 .config console log report ci-upstream-net-kasan-gce
2019/07/21 14:46 net-next-old 31cc088a4f5d 1656845f .config console log report ci-upstream-net-kasan-gce
2019/07/16 12:40 net-next-old 192f0f8e9db7 db842eb6 .config console log report ci-upstream-net-kasan-gce
2019/07/15 21:27 net-next-old 192f0f8e9db7 139ac68a .config console log report ci-upstream-net-kasan-gce
2019/07/07 02:59 net-next-old 23f30c41c732 f62e1e85 .config console log report ci-upstream-net-kasan-gce
2019/07/02 01:15 net-next-old 6e32a74a6f15 cccc4302 .config console log report ci-upstream-net-kasan-gce
2019/07/01 18:11 net-next-old 954a5a029472 907bf746 .config console log report ci-upstream-net-kasan-gce
2019/06/28 13:13 net-next-old a653f2f538f9 7509bf36 .config console log report ci-upstream-net-kasan-gce
2019/06/28 06:26 net-next-old a653f2f538f9 7509bf36 .config console log report ci-upstream-net-kasan-gce
2019/06/27 02:15 net-next-old 177d935a1370 7509bf36 .config console log report ci-upstream-net-kasan-gce
2019/06/21 19:51 net-next-old dca73a65a683 34bf9440 .config console log report ci-upstream-net-kasan-gce
2019/06/20 11:26 net-next-old dca73a65a683 34bf9440 .config console log report ci-upstream-net-kasan-gce
2019/06/19 12:25 net-next-old 39f588603238 34bf9440 .config console log report ci-upstream-net-kasan-gce
2019/06/17 11:34 net-next-old f464100f5766 442206d7 .config console log report ci-upstream-net-kasan-gce
2019/06/15 08:01 net-next-old 877cd9ffbc9c 442206d7 .config console log report ci-upstream-net-kasan-gce
2019/06/12 10:18 net-next-old 758a0a4d60ab 794a1ad7 .config console log report ci-upstream-net-kasan-gce
2018/07/01 19:21 net-next-old 1a84d7fdb5fc dba0b50e .config console log report ci-upstream-net-kasan-gce
2019/06/20 09:30 linux-next c0e4c41afeef 34bf9440 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.