================================================================== BUG: KASAN: use-after-free in tls_write_space+0x2f4/0x390 net/tls/tls_main.c:220 Read of size 1 at addr ffff8801c23edae0 by task syz-executor324/8358 CPU: 0 PID: 8358 Comm: syz-executor324 Not tainted 4.19.0-rc8+ #196 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+0x1c4/0x2b4 lib/dump_stack.c:113 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430 tls_write_space+0x2f4/0x390 net/tls/tls_main.c:220 tcp_new_space net/ipv4/tcp_input.c:5140 [inline] tcp_check_space+0x53f/0x920 net/ipv4/tcp_input.c:5151 tcp_data_snd_check net/ipv4/tcp_input.c:5161 [inline] tcp_rcv_established+0xe5e/0x21c0 net/ipv4/tcp_input.c:5642 tcp_v4_do_rcv+0x635/0x8f0 net/ipv4/tcp_ipv4.c:1534 tcp_v4_rcv+0x305b/0x3b20 net/ipv4/tcp_ipv4.c:1826 ip_local_deliver_finish+0x2e9/0xda0 net/ipv4/ip_input.c:215 NF_HOOK include/linux/netfilter.h:289 [inline] ip_local_deliver+0x1e9/0x750 net/ipv4/ip_input.c:256 dst_input include/net/dst.h:450 [inline] ip_rcv_finish+0x1f9/0x300 net/ipv4/ip_input.c:415 NF_HOOK include/linux/netfilter.h:289 [inline] ip_rcv+0xed/0x600 net/ipv4/ip_input.c:524 __netif_receive_skb_one_core+0x14d/0x200 net/core/dev.c:4913 __netif_receive_skb+0x2c/0x1e0 net/core/dev.c:5023 process_backlog+0x218/0x6f0 net/core/dev.c:5829 napi_poll net/core/dev.c:6249 [inline] net_rx_action+0x7c5/0x1950 net/core/dev.c:6315 __do_softirq+0x30b/0xad8 kernel/softirq.c:292 do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1047 do_softirq.part.13+0x126/0x160 kernel/softirq.c:336 do_softirq kernel/softirq.c:328 [inline] __local_bh_enable_ip+0x21d/0x260 kernel/softirq.c:189 __raw_spin_unlock_bh include/linux/spinlock_api_smp.h:176 [inline] _raw_spin_unlock_bh+0x30/0x40 kernel/locking/spinlock.c:200 spin_unlock_bh include/linux/spinlock.h:374 [inline] release_sock+0x1ec/0x2c0 net/core/sock.c:2860 tls_sk_proto_close+0x78e/0xbb0 net/tls/tls_main.c:312 inet_release+0x104/0x1f0 net/ipv4/af_inet.c:428 __sock_release+0x1d9/0x250 net/socket.c:579 sock_release+0x17/0x20 net/socket.c:598 smc_release+0x1a8/0x730 net/smc/af_smc.c:148 __sock_release+0xd7/0x250 net/socket.c:579 sock_close+0x19/0x20 net/socket.c:1141 __fput+0x385/0xa30 fs/file_table.c:278 ____fput+0x15/0x20 fs/file_table.c:309 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113 get_signal+0x155e/0x1980 kernel/signal.c:2343 do_signal+0x9c/0x21e0 arch/x86/kernel/signal.c:816 exit_to_usermode_loop+0x2e5/0x380 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_32_irqs_on arch/x86/entry/common.c:341 [inline] do_fast_syscall_32+0xcd5/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 RIP: 0023:0xf7f14ca9 Code: 85 d2 74 02 89 0a 5b 5d c3 8b 04 24 c3 8b 0c 24 c3 8b 1c 24 c3 90 90 90 90 90 90 90 90 90 90 90 90 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:00000000f7f101fc EFLAGS: 00000246 ORIG_RAX: 0000000000000004 RAX: 0000000000264000 RBX: 0000000000000005 RCX: 0000000020000040 RDX: 00000000ffffffc4 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 00000000003d0f00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 8358: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553 kmem_cache_alloc_trace+0x152/0x750 mm/slab.c:3620 kmalloc include/linux/slab.h:513 [inline] kzalloc include/linux/slab.h:707 [inline] create_ctx net/tls/tls_main.c:553 [inline] tls_init+0x201/0xbc0 net/tls/tls_main.c:683 tcp_set_ulp+0x1b8/0x520 net/ipv4/tcp_ulp.c:155 do_tcp_setsockopt.isra.40+0x452/0x2770 net/ipv4/tcp.c:2750 tcp_setsockopt+0xc1/0xe0 net/ipv4/tcp.c:3064 sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:3038 smc_setsockopt+0xcf/0x750 net/smc/af_smc.c:1640 __compat_sys_setsockopt+0x329/0x860 net/compat.c:407 __do_compat_sys_setsockopt net/compat.c:417 [inline] __se_compat_sys_setsockopt net/compat.c:414 [inline] __ia32_compat_sys_setsockopt+0xbd/0x150 net/compat.c:414 do_syscall_32_irqs_on arch/x86/entry/common.c:326 [inline] do_fast_syscall_32+0x34d/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 Freed by task 8358: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3498 [inline] kfree+0xcf/0x230 mm/slab.c:3813 tls_ctx_free.part.6+0x30/0x40 net/tls/tls_main.c:251 tls_ctx_free net/tls/tls_main.c:246 [inline] tls_sk_proto_close+0x768/0xbb0 net/tls/tls_main.c:307 inet_release+0x104/0x1f0 net/ipv4/af_inet.c:428 __sock_release+0x1d9/0x250 net/socket.c:579 sock_release+0x17/0x20 net/socket.c:598 smc_release+0x1a8/0x730 net/smc/af_smc.c:148 __sock_release+0xd7/0x250 net/socket.c:579 sock_close+0x19/0x20 net/socket.c:1141 __fput+0x385/0xa30 fs/file_table.c:278 ____fput+0x15/0x20 fs/file_table.c:309 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113 get_signal+0x155e/0x1980 kernel/signal.c:2343 do_signal+0x9c/0x21e0 arch/x86/kernel/signal.c:816 exit_to_usermode_loop+0x2e5/0x380 arch/x86/entry/common.c:162 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_32_irqs_on arch/x86/entry/common.c:341 [inline] do_fast_syscall_32+0xcd5/0xfb2 arch/x86/entry/common.c:397 entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139 The buggy address belongs to the object at ffff8801c23eda00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 224 bytes inside of 512-byte region [ffff8801c23eda00, ffff8801c23edc00) The buggy address belongs to the page: page:ffffea000708fb40 count:1 mapcount:0 mapping:ffff8801da800940 index:0xffff8801c23ed000 flags: 0x2fffc0000000100(slab) raw: 02fffc0000000100 ffffea0007087208 ffffea0006f44188 ffff8801da800940 raw: ffff8801c23ed000 ffff8801c23ed000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801c23ed980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8801c23eda00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8801c23eda80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8801c23edb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8801c23edb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================