syzbot


KASAN: use-after-free Read in tcp_ack

Status: auto-closed as invalid on 2019/12/19 23:16
Reported-by: syzbot+ab2ca73ff67fe69b8944@syzkaller.appspotmail.com
First crash: 1018d, last: 1008d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 KASAN: use-after-free Read in tcp_ack 9 1008d 1018d 0/1 auto-closed as invalid on 2020/01/18 23:16
upstream KASAN: use-after-free Read in tcp_ack 68 1682d 1684d 3/22 fixed on 2017/11/28 03:36

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in tcp_ack_probe net/ipv4/tcp_input.c:3292 [inline]
BUG: KASAN: use-after-free in tcp_ack+0x414f/0x4760 net/ipv4/tcp_input.c:3714
Read of size 4 at addr ffff888097e2d5ac by task syz-executor.0/8457

CPU: 0 PID: 8457 Comm: syz-executor.0 Not tainted 4.14.145 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x197 lib/dump_stack.c:53
 print_address_description.cold+0x7c/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/0x2af mm/kasan/report.c:393
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
 tcp_ack_probe net/ipv4/tcp_input.c:3292 [inline]
 tcp_ack+0x414f/0x4760 net/ipv4/tcp_input.c:3714
 tcp_rcv_established+0x3e9/0x1650 net/ipv4/tcp_input.c:5555
 tcp_v6_do_rcv+0x417/0x1190 net/ipv6/tcp_ipv6.c:1301
 tcp_v6_rcv+0x2446/0x2ed0 net/ipv6/tcp_ipv6.c:1519
 ip6_input_finish+0x300/0x15a0 net/ipv6/ip6_input.c:284
 NF_HOOK include/linux/netfilter.h:250 [inline]
 NF_HOOK include/linux/netfilter.h:244 [inline]
 ip6_input+0xd5/0x340 net/ipv6/ip6_input.c:327
 dst_input include/net/dst.h:468 [inline]
 ip6_rcv_finish+0x23f/0x7a0 net/ipv6/ip6_input.c:71
 NF_HOOK include/linux/netfilter.h:250 [inline]
 NF_HOOK include/linux/netfilter.h:244 [inline]
 ipv6_rcv+0xe4d/0x1d20 net/ipv6/ip6_input.c:208
 __netif_receive_skb_core+0x1eae/0x2ca0 net/core/dev.c:4477
 __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4515
 process_backlog+0x21f/0x730 net/core/dev.c:5197
 napi_poll net/core/dev.c:5598 [inline]
 net_rx_action+0x490/0xf80 net/core/dev.c:5664
 __do_softirq+0x244/0x9a0 kernel/softirq.c:288
 do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:1015
 </IRQ>
 do_softirq.part.0+0x10e/0x160 kernel/softirq.c:332
 do_softirq kernel/softirq.c:324 [inline]
 __local_bh_enable_ip+0x154/0x1a0 kernel/softirq.c:185
 local_bh_enable include/linux/bottom_half.h:32 [inline]
 rcu_read_unlock_bh include/linux/rcupdate.h:725 [inline]
 ip6_finish_output2+0x9f3/0x21b0 net/ipv6/ip6_output.c:121
 ip6_finish_output+0x4f4/0xb50 net/ipv6/ip6_output.c:154
 NF_HOOK_COND include/linux/netfilter.h:239 [inline]
 ip6_output+0x20f/0x6d0 net/ipv6/ip6_output.c:171
 dst_output include/net/dst.h:462 [inline]
 NF_HOOK include/linux/netfilter.h:250 [inline]
 NF_HOOK include/linux/netfilter.h:244 [inline]
 ip6_xmit+0xd53/0x1eb0 net/ipv6/ip6_output.c:275
 inet6_csk_xmit+0x286/0x4d0 net/ipv6/inet6_connection_sock.c:139
 __tcp_transmit_skb+0x172c/0x2fe0 net/ipv4/tcp_output.c:1130
 tcp_transmit_skb net/ipv4/tcp_output.c:1146 [inline]
 tcp_write_xmit+0x523/0x4960 net/ipv4/tcp_output.c:2382
 __tcp_push_pending_frames+0xa6/0x260 net/ipv4/tcp_output.c:2563
 tcp_send_fin+0x17e/0xc40 net/ipv4/tcp_output.c:3115
 tcp_close+0xcc8/0xfb0 net/ipv4/tcp.c:2221
 inet_release+0xec/0x1c0 net/ipv4/af_inet.c:425
 inet6_release+0x53/0x80 net/ipv6/af_inet6.c:450
 __sock_release+0xce/0x2b0 net/socket.c:602
 sock_close+0x1b/0x30 net/socket.c:1139
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1da/0x220 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+0x4bc/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4136f1
RSP: 002b:00007ffc49a9a420 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000009 RCX: 00000000004136f1
RDX: 0000000000000000 RSI: 00000000000009a7 RDI: 0000000000000008
RBP: 0000000000000001 R08: 00000000e64469a7 R09: 00000000e64469ab
R10: 00007ffc49a9a500 R11: 0000000000000293 R12: 000000000075c9a0
R13: 000000000075c9a0 R14: 00000000007616e0 R15: 000000000075c124

Allocated by task 8459:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc_node+0x144/0x780 mm/slab.c:3642
 __alloc_skb+0x9c/0x500 net/core/skbuff.c:193
 alloc_skb_fclone include/linux/skbuff.h:1022 [inline]
 sk_stream_alloc_skb+0xb3/0x780 net/ipv4/tcp.c:855
 tcp_sendmsg_locked+0xf61/0x3200 net/ipv4/tcp.c:1301
 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1457
 inet_sendmsg+0x122/0x500 net/ipv4/af_inet.c:762
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xce/0x110 net/socket.c:656
 SYSC_sendto+0x206/0x310 net/socket.c:1763
 SyS_sendto+0x40/0x50 net/socket.c:1731
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 8459:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
 kfree_skbmem+0x8d/0x120 net/core/skbuff.c:607
 __kfree_skb+0x1e/0x30 net/core/skbuff.c:646
 sk_wmem_free_skb include/net/sock.h:1416 [inline]
 tcp_remove_empty_skb.part.0+0x231/0x2e0 net/ipv4/tcp.c:929
 tcp_remove_empty_skb net/ipv4/tcp.c:925 [inline]
 tcp_sendmsg_locked+0x1ced/0x3200 net/ipv4/tcp.c:1435
 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1457
 inet_sendmsg+0x122/0x500 net/ipv4/af_inet.c:762
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xce/0x110 net/socket.c:656
 SYSC_sendto+0x206/0x310 net/socket.c:1763
 SyS_sendto+0x40/0x50 net/socket.c:1731
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff888097e2d580
 which belongs to the cache skbuff_fclone_cache of size 472
The buggy address is located 44 bytes inside of
 472-byte region [ffff888097e2d580, ffff888097e2d758)
The buggy address belongs to the page:
page:ffffea00025f8b40 count:1 mapcount:0 mapping:ffff888097e2d080 index:0xffff888097e2d300
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff888097e2d080 ffff888097e2d300 0000000100000003
raw: ffffea00025254e0 ffffea0002324160 ffff88821b7203c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888097e2d480: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc
 ffff888097e2d500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888097e2d580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff888097e2d600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888097e2d680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (30):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2019/09/20 23:15 linux-4.14.y b10ab5e2c476 d96e88f3 .config log report
ci2-linux-4-14 2019/09/20 22:03 linux-4.14.y b10ab5e2c476 d96e88f3 .config log report
ci2-linux-4-14 2019/09/20 04:39 linux-4.14.y b10ab5e2c476 4d3ae0b7 .config log report
ci2-linux-4-14 2019/09/20 03:31 linux-4.14.y b10ab5e2c476 4d3ae0b7 .config log report
ci2-linux-4-14 2019/09/20 02:07 linux-4.14.y b10ab5e2c476 4d3ae0b7 .config log report
ci2-linux-4-14 2019/09/20 00:55 linux-4.14.y b10ab5e2c476 4d3ae0b7 .config log report
ci2-linux-4-14 2019/09/19 16:38 linux-4.14.y b10ab5e2c476 eb940044 .config log report
ci2-linux-4-14 2019/09/19 13:53 linux-4.14.y b10ab5e2c476 eb940044 .config log report
ci2-linux-4-14 2019/09/19 09:48 linux-4.14.y b10ab5e2c476 eb940044 .config log report
ci2-linux-4-14 2019/09/18 17:55 linux-4.14.y 968722f5371a 46c0be24 .config log report
ci2-linux-4-14 2019/09/17 20:15 linux-4.14.y 968722f5371a 13dcda9b .config log report
ci2-linux-4-14 2019/09/17 19:55 linux-4.14.y 968722f5371a 13dcda9b .config log report
ci2-linux-4-14 2019/09/17 18:21 linux-4.14.y 968722f5371a 13dcda9b .config log report
ci2-linux-4-14 2019/09/16 22:52 linux-4.14.y 968722f5371a 51ca0454 .config log report
ci2-linux-4-14 2019/09/16 14:34 linux-4.14.y 968722f5371a 55c50e70 .config log report
ci2-linux-4-14 2019/09/15 21:18 linux-4.14.y e2cd24b62938 32d59357 .config log report
ci2-linux-4-14 2019/09/15 11:11 linux-4.14.y e2cd24b62938 32d59357 .config log report
ci2-linux-4-14 2019/09/14 23:37 linux-4.14.y e2cd24b62938 32d59357 .config log report
ci2-linux-4-14 2019/09/14 20:23 linux-4.14.y e2cd24b62938 32d59357 .config log report
ci2-linux-4-14 2019/09/13 23:13 linux-4.14.y e2cd24b62938 32d59357 .config log report
ci2-linux-4-14 2019/09/13 13:58 linux-4.14.y e2cd24b62938 40fa42bc .config log report
ci2-linux-4-14 2019/09/12 10:46 linux-4.14.y e2cd24b62938 0b7672ee .config log report
ci2-linux-4-14 2019/09/12 07:55 linux-4.14.y e2cd24b62938 f4e53c10 .config log report
ci2-linux-4-14 2019/09/12 06:38 linux-4.14.y e2cd24b62938 f4e53c10 .config log report
ci2-linux-4-14 2019/09/11 23:29 linux-4.14.y e2cd24b62938 f4e53c10 .config log report
ci2-linux-4-14 2019/09/11 22:16 linux-4.14.y e2cd24b62938 f4e53c10 .config log report
ci2-linux-4-14 2019/09/11 21:51 linux-4.14.y e2cd24b62938 f4e53c10 .config log report
ci2-linux-4-14 2019/09/11 05:21 linux-4.14.y e2cd24b62938 a60cb4cd .config log report
ci2-linux-4-14 2019/09/10 23:37 linux-4.14.y e2cd24b62938 a60cb4cd .config log report
ci2-linux-4-14 2019/09/10 23:25 linux-4.14.y e2cd24b62938 a60cb4cd .config log report