================================================================== BUG: KASAN: use-after-free in tls_write_space+0x228/0x290 net/tls/tls_main.c:222 Read of size 1 at addr ffff888089bb2370 by task syz-executor.1/4137 CPU: 1 PID: 4137 Comm: syz-executor.1 Not tainted 4.14.184-syzkaller #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+0x1b2/0x283 lib/dump_stack.c:58 print_address_description.cold+0x54/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/0x2b9 mm/kasan/report.c:393 tls_write_space+0x228/0x290 net/tls/tls_main.c:222 tcp_new_space net/ipv4/tcp_input.c:5103 [inline] tcp_check_space+0x395/0x640 net/ipv4/tcp_input.c:5114 tcp_data_snd_check net/ipv4/tcp_input.c:5124 [inline] tcp_rcv_established+0x62b/0x15e0 net/ipv4/tcp_input.c:5570 tcp_v4_do_rcv+0x56c/0x800 net/ipv4/tcp_ipv4.c:1467 sk_backlog_rcv include/net/sock.h:917 [inline] __release_sock+0x12a/0x350 net/core/sock.c:2267 release_sock+0x54/0x1b0 net/core/sock.c:2782 tls_sk_proto_close+0x54f/0x7f0 net/tls/tls_main.c:294 inet_release+0xdf/0x1b0 net/ipv4/af_inet.c:425 __sock_release+0x1fc/0x2b0 net/socket.c:602 smc_release+0x1e4/0x610 net/smc/af_smc.c:141 __sock_release+0xcd/0x2b0 net/socket.c:602 sock_close+0x15/0x20 net/socket.c:1139 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x113/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x416651 RSP: 002b:00007ffd4e9111b0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000416651 RDX: 0000001b31320000 RSI: 0000000000000b9d RDI: 0000000000000003 RBP: 0000000000000001 R08: 00000000493cab9d R09: 00000000493caba1 R10: 00007ffd4e9112a0 R11: 0000000000000293 R12: 000000000078c900 R13: 000000000078c900 R14: ffffffffffffffff R15: 000000000078bf0c Allocated by task 4140: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.0+0x4f/0xd0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x14d/0x3f0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] tls_init+0xb1/0x4e0 net/tls/tls_main.c:518 tcp_set_ulp+0x18f/0x493 net/ipv4/tcp_ulp.c:127 do_tcp_setsockopt.isra.0+0x1f6/0x1c70 net/ipv4/tcp.c:2544 tcp_setsockopt+0xa7/0xc0 net/ipv4/tcp.c:2830 SYSC_setsockopt net/socket.c:1865 [inline] SyS_setsockopt+0x110/0x1e0 net/socket.c:1844 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb Freed by task 4137: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xaf/0x190 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xcb/0x260 mm/slab.c:3815 tls_ctx_free net/tls/tls_main.c:252 [inline] tls_ctx_free net/tls/tls_main.c:246 [inline] tls_sk_proto_close+0x542/0x7f0 net/tls/tls_main.c:290 inet_release+0xdf/0x1b0 net/ipv4/af_inet.c:425 __sock_release+0x1fc/0x2b0 net/socket.c:602 smc_release+0x1e4/0x610 net/smc/af_smc.c:141 __sock_release+0xcd/0x2b0 net/socket.c:602 sock_close+0x15/0x20 net/socket.c:1139 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x113/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x46/0xbb The buggy address belongs to the object at ffff888089bb2300 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 112 bytes inside of 192-byte region [ffff888089bb2300, ffff888089bb23c0) The buggy address belongs to the page: page:ffffea000226ec80 count:1 mapcount:0 mapping:ffff888089bb2000 index:0x0 flags: 0xfffe0000000100(slab) raw: 00fffe0000000100 ffff888089bb2000 0000000000000000 0000000100000010 raw: ffffea00022cdb60 ffffea0002385420 ffff8880aa800040 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888089bb2200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888089bb2280: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888089bb2300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888089bb2380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888089bb2400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================