================================================================== BUG: KASAN: use-after-free in tls_push_sg+0x66b/0x670 net/tls/tls_main.c:131 Read of size 4 at addr ffff88805cf65780 by task syz-executor.4/19971 CPU: 1 PID: 19971 Comm: syz-executor.4 Not tainted 5.3.0-rc2-next-20190729 #54 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+0xd4/0x306 mm/kasan/report.c:351 __kasan_report.cold+0x1b/0x36 mm/kasan/report.c:482 kasan_report+0x12/0x17 mm/kasan/common.c:610 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:131 tls_push_sg+0x66b/0x670 net/tls/tls_main.c:131 tls_tx_records+0x3b7/0x740 net/tls/tls_sw.c:400 tls_push_record+0x1e7c/0x3410 net/tls/tls_sw.c:750 bpf_exec_tx_verdict+0xe18/0x1270 net/tls/tls_sw.c:770 tls_sw_sendmsg+0x107c/0x17b0 net/tls/tls_sw.c:980 inet6_sendmsg+0x9e/0xe0 net/ipv6/af_inet6.c:576 sock_sendmsg_nosec net/socket.c:637 [inline] sock_sendmsg+0xd7/0x130 net/socket.c:657 ___sys_sendmsg+0x803/0x920 net/socket.c:2311 __sys_sendmsg+0x105/0x1d0 net/socket.c:2356 __do_sys_sendmsg net/socket.c:2365 [inline] __se_sys_sendmsg net/socket.c:2363 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2363 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290 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:00007ff85e9c1c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459829 RDX: 0000000000000000 RSI: 0000000020000200 RDI: 0000000000000004 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff85e9c26d4 R13: 00000000004c7463 R14: 00000000004dcab8 R15: 00000000ffffffff Allocated by task 19971: save_stack+0x23/0x90 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc mm/kasan/common.c:486 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:459 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:500 __do_kmalloc mm/slab.c:3655 [inline] __kmalloc+0x163/0x770 mm/slab.c:3664 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:686 [inline] tls_get_rec+0xfe/0x590 net/tls/tls_sw.c:322 tls_sw_sendmsg+0xda5/0x17b0 net/tls/tls_sw.c:928 inet6_sendmsg+0x9e/0xe0 net/ipv6/af_inet6.c:576 sock_sendmsg_nosec net/socket.c:637 [inline] sock_sendmsg+0xd7/0x130 net/socket.c:657 ___sys_sendmsg+0x803/0x920 net/socket.c:2311 __sys_sendmsg+0x105/0x1d0 net/socket.c:2356 __do_sys_sendmsg net/socket.c:2365 [inline] __se_sys_sendmsg net/socket.c:2363 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2363 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 19971: save_stack+0x23/0x90 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:448 kasan_slab_free+0xe/0x10 mm/kasan/common.c:456 __cache_free mm/slab.c:3425 [inline] kfree+0x10a/0x2c0 mm/slab.c:3756 tls_sw_release_resources_tx+0x4d4/0x6b0 net/tls/tls_sw.c:2087 tls_sk_proto_cleanup+0x248/0x3e0 net/tls/tls_main.c:302 tls_sk_proto_unhash+0x90/0x3f0 net/tls/tls_main.c:330 tcp_set_state+0x5b9/0x7d0 net/ipv4/tcp.c:2235 tcp_done+0xe2/0x320 net/ipv4/tcp.c:3824 tcp_reset+0x132/0x500 net/ipv4/tcp_input.c:4080 tcp_validate_incoming+0xa2d/0x1660 net/ipv4/tcp_input.c:5440 tcp_rcv_established+0x6b5/0x1e70 net/ipv4/tcp_input.c:5648 tcp_v6_do_rcv+0x41e/0x12c0 net/ipv6/tcp_ipv6.c:1356 sk_backlog_rcv include/net/sock.h:945 [inline] __release_sock+0x129/0x390 net/core/sock.c:2418 release_sock+0x59/0x1c0 net/core/sock.c:2934 sk_stream_wait_memory+0x65a/0xfc0 net/core/stream.c:149 do_tcp_sendpages+0x86b/0x1bc0 net/ipv4/tcp.c:1048 tls_push_sg+0x1de/0x670 net/tls/tls_main.c:122 tls_tx_records+0x3b7/0x740 net/tls/tls_sw.c:400 tls_push_record+0x1e7c/0x3410 net/tls/tls_sw.c:750 bpf_exec_tx_verdict+0xe18/0x1270 net/tls/tls_sw.c:770 tls_sw_sendmsg+0x107c/0x17b0 net/tls/tls_sw.c:980 inet6_sendmsg+0x9e/0xe0 net/ipv6/af_inet6.c:576 sock_sendmsg_nosec net/socket.c:637 [inline] sock_sendmsg+0xd7/0x130 net/socket.c:657 ___sys_sendmsg+0x803/0x920 net/socket.c:2311 __sys_sendmsg+0x105/0x1d0 net/socket.c:2356 __do_sys_sendmsg net/socket.c:2365 [inline] __se_sys_sendmsg net/socket.c:2363 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2363 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88805cf65480 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 768 bytes inside of 2048-byte region [ffff88805cf65480, ffff88805cf65c80) The buggy address belongs to the page: page:ffffea000173d900 refcount:1 mapcount:0 mapping:ffff8880aa400e00 index:0x0 compound_mapcount: 0 flags: 0x1fffc0000010200(slab|head) raw: 01fffc0000010200 ffffea000181ed08 ffffea00017b7208 ffff8880aa400e00 raw: 0000000000000000 ffff88805cf64380 0000000100000003 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88805cf65680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805cf65700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805cf65780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805cf65800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805cf65880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================