================================================================== BUG: KASAN: use-after-free in tls_write_space+0x10f/0x130 net/tls/tls_main.c:239 Read of size 1 at addr ffff88808af03daa by task syz-executor.2/19861 CPU: 1 PID: 19861 Comm: syz-executor.2 Not tainted 5.3.0-rc2+ #60 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+0x1d8/0x2f8 lib/dump_stack.c:113 print_address_description+0x75/0x5b0 mm/kasan/report.c:351 __kasan_report+0x14b/0x1c0 mm/kasan/report.c:482 kasan_report+0x26/0x50 mm/kasan/common.c:612 __asan_report_load1_noabort+0x14/0x20 mm/kasan/generic_report.c:129 tls_write_space+0x10f/0x130 net/tls/tls_main.c:239 tcp_new_space net/ipv4/tcp_input.c:5151 [inline] tcp_check_space net/ipv4/tcp_input.c:5162 [inline] tcp_data_snd_check+0x1f3/0x2b0 net/ipv4/tcp_input.c:5172 tcp_rcv_established+0xcad/0x20e0 net/ipv4/tcp_input.c:5663 tcp_v6_do_rcv+0x4de/0x12c0 net/ipv6/tcp_ipv6.c:1356 sk_backlog_rcv include/net/sock.h:945 [inline] __release_sock+0x1c1/0x4a0 net/core/sock.c:2418 release_sock+0x65/0x1d0 net/core/sock.c:2934 tls_sk_proto_close+0x18a/0x5b0 net/tls/tls_main.c:313 inet_release+0x165/0x1c0 net/ipv4/af_inet.c:427 inet6_release+0x57/0x70 net/ipv6/af_inet6.c:470 __sock_release net/socket.c:590 [inline] sock_close+0xe1/0x260 net/socket.c:1268 __fput+0x2e4/0x740 fs/file_table.c:280 ____fput+0x15/0x20 fs/file_table.c:313 task_work_run+0x17e/0x1b0 kernel/task_work.c:113 get_signal+0x1d2c/0x1dd0 kernel/signal.c:2523 do_signal+0x7b/0x720 arch/x86/kernel/signal.c:815 exit_to_usermode_loop arch/x86/entry/common.c:159 [inline] prepare_exit_to_usermode+0x303/0x580 arch/x86/entry/common.c:194 syscall_return_slowpath+0x113/0x4a0 arch/x86/entry/common.c:274 do_syscall_64+0x126/0x140 arch/x86/entry/common.c:299 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x459829 Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ff149441c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: 000000000026c000 RBX: 0000000000000006 RCX: 0000000000459829 RDX: ffffffffffffffc1 RSI: 00000000200005c0 RDI: 0000000000000003 RBP: 000000000075bfc8 R08: 0000000000000000 R09: 1201000000003618 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff1494426d4 R13: 00000000004c77d9 R14: 00000000004dcf90 R15: 00000000ffffffff Allocated by task 19861: save_stack mm/kasan/common.c:69 [inline] set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc+0x11c/0x1b0 mm/kasan/common.c:487 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:501 kmem_cache_alloc_trace+0x221/0x2f0 mm/slab.c:3550 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:748 [inline] create_ctx net/tls/tls_main.c:602 [inline] tls_init+0x138/0x6e0 net/tls/tls_main.c:788 __tcp_set_ulp net/ipv4/tcp_ulp.c:126 [inline] tcp_set_ulp+0x443/0x4f0 net/ipv4/tcp_ulp.c:147 do_tcp_setsockopt+0x291/0x2960 net/ipv4/tcp.c:2808 tcp_setsockopt+0x4e/0xd0 net/ipv4/tcp.c:3135 sock_common_setsockopt+0x99/0xb0 net/core/sock.c:3130 __sys_setsockopt+0x683/0x870 net/socket.c:2084 __do_sys_setsockopt net/socket.c:2100 [inline] __se_sys_setsockopt net/socket.c:2097 [inline] __x64_sys_setsockopt+0xbf/0xd0 net/socket.c:2097 do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 19861: save_stack mm/kasan/common.c:69 [inline] set_track mm/kasan/common.c:77 [inline] __kasan_slab_free+0x12a/0x1e0 mm/kasan/common.c:449 kasan_slab_free+0xe/0x10 mm/kasan/common.c:457 __cache_free mm/slab.c:3425 [inline] kfree+0x115/0x200 mm/slab.c:3756 tls_ctx_free net/tls/tls_main.c:261 [inline] tls_sk_proto_close+0x3f5/0x5b0 net/tls/tls_main.c:308 inet_release+0x165/0x1c0 net/ipv4/af_inet.c:427 inet6_release+0x57/0x70 net/ipv6/af_inet6.c:470 __sock_release net/socket.c:590 [inline] sock_close+0xe1/0x260 net/socket.c:1268 __fput+0x2e4/0x740 fs/file_table.c:280 ____fput+0x15/0x20 fs/file_table.c:313 task_work_run+0x17e/0x1b0 kernel/task_work.c:113 get_signal+0x1d2c/0x1dd0 kernel/signal.c:2523 do_signal+0x7b/0x720 arch/x86/kernel/signal.c:815 exit_to_usermode_loop arch/x86/entry/common.c:159 [inline] prepare_exit_to_usermode+0x303/0x580 arch/x86/entry/common.c:194 syscall_return_slowpath+0x113/0x4a0 arch/x86/entry/common.c:274 do_syscall_64+0x126/0x140 arch/x86/entry/common.c:299 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88808af03d40 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 106 bytes inside of 512-byte region [ffff88808af03d40, ffff88808af03f40) The buggy address belongs to the page: page:ffffea00022bc0c0 refcount:1 mapcount:0 mapping:ffff8880aa400a80 index:0xffff88808af030c0 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea0001f01d08 ffffea00024ca008 ffff8880aa400a80 raw: ffff88808af030c0 ffff88808af030c0 0000000100000003 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88808af03c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88808af03d00: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff88808af03d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88808af03e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88808af03e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================