syzbot


KASAN: use-after-free Read in tcp_check_sack_reordering

Status: fixed on 2020/02/19 00:41
Reported-by: syzbot+31f74e6d5a3bad6302cc@syzkaller.appspotmail.com
Fix commit: fb56687038cf ttyprintk: fix a potential deadlock in interrupt context issue
First crash: 1504d, last: 1504d
Fix bisection: fixed by (bisect log) :
commit fb56687038cfd0e82b6185bdb134d5d7c2b6073f
Author: Zhenzhong Duan <zhenzhong.duan@gmail.com>
Date: Mon Jan 13 03:48:42 2020 +0000

  ttyprintk: fix a potential deadlock in interrupt context issue

  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in tcp_check_sack_reordering net C done 2 1497d 1506d 15/26 fixed on 2020/02/18 14:31

Sample crash report:
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
==================================================================
IPv6: ADDRCONF(NETDEV_UP): batadv_slave_1: link is not ready
BUG: KASAN: use-after-free in tcp_highest_sack_seq include/net/tcp.h:1775 [inline]
BUG: KASAN: use-after-free in tcp_highest_sack_seq include/net/tcp.h:1767 [inline]
BUG: KASAN: use-after-free in tcp_check_sack_reordering+0x33c/0x3a0 net/ipv4/tcp_input.c:877
Read of size 4 at addr ffff88808aeeb5a8 by task syz-executor441/8278

CPU: 0 PID: 8278 Comm: syz-executor441 Not tainted 4.19.97-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
batman_adv: batadv0: Interface activated: batadv_slave_1
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x197/0x210 lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
IPv6: ADDRCONF(NETDEV_UP): veth0_macvtap: link is not ready
 tcp_highest_sack_seq include/net/tcp.h:1775 [inline]
 tcp_highest_sack_seq include/net/tcp.h:1767 [inline]
 tcp_check_sack_reordering+0x33c/0x3a0 net/ipv4/tcp_input.c:877
IPv6: ADDRCONF(NETDEV_UP): veth1_macvtap: link is not ready
 tcp_try_undo_partial net/ipv4/tcp_input.c:2716 [inline]
 tcp_fastretrans_alert+0x1070/0x2550 net/ipv4/tcp_input.c:2833
 tcp_ack+0x2859/0x5120 net/ipv4/tcp_input.c:3688
device veth0_macvtap entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): macvtap0: link is not ready
 tcp_rcv_established+0x725/0x1f10 net/ipv4/tcp_input.c:5638
device veth1_macvtap entered promiscuous mode
 tcp_v4_do_rcv+0x61f/0x8d0 net/ipv4/tcp_ipv4.c:1535
 sk_backlog_rcv include/net/sock.h:946 [inline]
 __release_sock+0x129/0x390 net/core/sock.c:2339
IPv6: ADDRCONF(NETDEV_UP): macsec0: link is not ready
 release_sock+0x59/0x1c0 net/core/sock.c:2855
 sk_stream_wait_memory+0x590/0xe50 net/core/stream.c:145
IPv6: ADDRCONF(NETDEV_UP): veth0_to_batadv: link is not ready
IPv6: ADDRCONF(NETDEV_UP): veth1_to_batadv: link is not ready
 tcp_sendmsg_locked+0xdec/0x3290 net/ipv4/tcp.c:1413
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1454
 inet_sendmsg+0x141/0x5d0 net/ipv4/af_inet.c:798
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 __sys_sendto+0x262/0x380 net/socket.c:1787
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
 __do_sys_sendto net/socket.c:1799 [inline]
 __se_sys_sendto net/socket.c:1795 [inline]
 __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1795
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x449cd9
Code: e8 1c e6 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 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 8b 06 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f4b0c912d88 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0
RAX: ffffffffffffffda RBX: 00000000006e6a08 RCX: 0000000000449cd9
RDX: ffffffffffffff67 RSI: 0000000020000640 RDI: 0000000000000003
RBP: 00000000006e6a00 R08: 0000000000000000 R09: ffffffffffffff4f
R10: 00000000040007bd R11: 0000000000000246 R12: 00000000006e6a0c
R13: 0000000001001eac R14: 0000000400000003 R15: 01001eac01131eac

Allocated by task 8278:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc_node+0x144/0x710 mm/slab.c:3649
 __alloc_skb+0xd5/0x5f0 net/core/skbuff.c:193
 alloc_skb_fclone include/linux/skbuff.h:1037 [inline]
 sk_stream_alloc_skb+0xc8/0x860 net/ipv4/tcp.c:874
 tcp_sendmsg_locked+0xc9d/0x3290 net/ipv4/tcp.c:1303
 tcp_sendmsg+0x30/0x50 net/ipv4/tcp.c:1454
IPv6: ADDRCONF(NETDEV_UP): batadv_slave_0: link is not ready
 inet_sendmsg+0x141/0x5d0 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:632
 __sys_sendto+0x262/0x380 net/socket.c:1787
 __do_sys_sendto net/socket.c:1799 [inline]
 __se_sys_sendto net/socket.c:1795 [inline]
 __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1795
batman_adv: batadv0: Interface activated: batadv_slave_0
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8281:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x86/0x260 mm/slab.c:3765
 kfree_skbmem+0xad/0x160 net/core/skbuff.c:607
 __kfree_skb+0x1e/0x30 net/core/skbuff.c:646
 sk_eat_skb include/net/sock.h:2421 [inline]
 tcp_recvmsg+0x133c/0x29a0 net/ipv4/tcp.c:2150
 inet_recvmsg+0x136/0x5f0 net/ipv4/af_inet.c:830
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
 sock_recvmsg_nosec net/socket.c:795 [inline]
 sock_recvmsg net/socket.c:802 [inline]
 sock_recvmsg+0xce/0x110 net/socket.c:798
 __sys_recvfrom+0x1ff/0x350 net/socket.c:1844
 __do_sys_recvfrom net/socket.c:1862 [inline]
 __se_sys_recvfrom net/socket.c:1858 [inline]
 __x64_sys_recvfrom+0xe1/0x1a0 net/socket.c:1858
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
The buggy address belongs to the object at ffff88808aeeb580
 which belongs to the cache skbuff_fclone_cache of size 472
The buggy address is located 40 bytes inside of
 472-byte region [ffff88808aeeb580, ffff88808aeeb758)
The buggy address belongs to the page:
page:ffffea00022bbac0 count:1 mapcount:0 mapping:ffff8880a98c6c40 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea0002487f48 ffffea000220dec8 ffff8880a98c6c40
raw: 0000000000000000 ffff88808aeeb080 0000000100000006 0000000000000000
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808aeeb480: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc
 ffff88808aeeb500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88808aeeb580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
                                  ^
 ffff88808aeeb600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808aeeb680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
IPv6: ADDRCONF(NETDEV_UP): batadv_slave_1: link is not ready

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/19 19:46 linux-4.19.y dc4ba5be1bab 0342f8c7 .config console log report syz C ci2-linux-4-19
* Struck through repros no longer work on HEAD.