syzbot


KASAN: use-after-free Read in ccid2_hc_tx_packet_recv

Status: upstream: reported C repro on 2019/11/04 11:20
Reported-by: syzbot+70b1475fd21069ad4195@syzkaller.appspotmail.com
First crash: 1632d, last: 1411d
Cause bisection: introduced by (bisect log) :
commit 3fa6f616a7a4d0bdf4d877d530456d8a5c3b109b
Author: David Ahern <dsahern@gmail.com>
Date: Mon Aug 7 15:44:17 2017 +0000

  net: ipv4: add second dif to inet socket lookups

Crash: KASAN: use-after-free Read in ccid2_hc_tx_packet_recv (log)
Repro: C syz .config
  
Fix bisection: failed (error log, bisect log)
  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in ccid2_hc_tx_packet_recv (2) C done inconclusive 3 1418d 1626d 0/1 upstream: reported C repro on 2019/11/09 21:41
linux-4.14 KASAN: use-after-free Read in ccid2_hc_tx_packet_recv 1 1777d 1777d 0/1 auto-closed as invalid on 2019/10/25 08:37
upstream KASAN: use-after-free Read in ccid2_hc_tx_packet_recv dccp C done error 102 6d05h 2213d 0/26 upstream: reported C repro on 2018/04/02 09:20
Last patch testing requests (1)
Created Duration User Patch Repo Result
2022/08/28 00:27 13m retest repro linux-4.19.y error OK
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2020/07/11 12:23 0m bisect fix linux-4.19.y error job log (0)
2020/06/11 11:25 26m bisect fix linux-4.19.y job log (0) log
2020/05/12 10:58 26m bisect fix linux-4.19.y job log (0) log
2020/04/12 10:33 24m bisect fix linux-4.19.y job log (0) log
2020/03/13 10:05 27m bisect fix linux-4.19.y job log (0) log
2020/02/12 09:40 24m bisect fix linux-4.19.y job log (0) log
2020/01/13 09:15 25m bisect fix linux-4.19.y job log (0) log
2019/12/14 08:50 24m bisect fix linux-4.19.y job log (0) log

Sample crash report:
RBP: 0000000000000006 R08: 0000000000000001 R09: 0000000000000039
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006e49ec
R13: 00007ffc68bd79bf R14: 00007fc261f4d9c0 R15: 0000000000000064
dccp_parse_options: DCCP(000000005d46a545): Option 32 (len=7) error=9
==================================================================
BUG: KASAN: use-after-free in ccid2_hc_tx_packet_recv+0x21ca/0x223b net/dccp/ccids/ccid2.c:600
Read of size 1 at addr ffff8880811669e2 by task syz-executor933/7547

CPU: 0 PID: 7547 Comm: syz-executor933 Not tainted 4.19.81 #0
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+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_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 ccid2_hc_tx_packet_recv+0x21ca/0x223b net/dccp/ccids/ccid2.c:600
 ccid_hc_tx_packet_recv net/dccp/ccid.h:192 [inline]
 dccp_deliver_input_to_ccids+0x1f8/0x270 net/dccp/input.c:186
 dccp_rcv_established net/dccp/input.c:378 [inline]
 dccp_rcv_established+0x83/0xb0 net/dccp/input.c:368
 dccp_v4_do_rcv+0x13f/0x190 net/dccp/ipv4.c:656
 sk_backlog_rcv include/net/sock.h:941 [inline]
 __release_sock+0x129/0x390 net/core/sock.c:2339
 release_sock+0x59/0x1c0 net/core/sock.c:2855
 dccp_sendmsg+0x683/0xd00 net/dccp/proto.c:818
 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_sendmsg+0x3e2/0x920 net/socket.c:2115
 __sys_sendmmsg+0x1bf/0x4e0 net/socket.c:2210
 __do_sys_sendmmsg net/socket.c:2239 [inline]
 __se_sys_sendmmsg net/socket.c:2236 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2236
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x448e39
Code: e8 8c 10 03 00 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 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fc261f4ccb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007fc261f4ccc0 RCX: 0000000000448e39
RDX: 04000000000001e6 RSI: 0000000020000c00 RDI: 0000000000000005
RBP: 0000000000000006 R08: 0000000000000001 R09: 0000000000000039
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006e49ec
R13: 00007ffc68bd79bf R14: 00007fc261f4d9c0 R15: 0000000000000064

Allocated by task 7547:
 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
 __do_kmalloc_node mm/slab.c:3689 [inline]
 __kmalloc_node_track_caller+0x51/0x80 mm/slab.c:3703
 __kmalloc_reserve.isra.0+0x40/0xf0 net/core/skbuff.c:137
 __alloc_skb+0x10b/0x5f0 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:995 [inline]
 dccp_send_ack+0xd6/0x360 net/dccp/output.c:580
 ccid2_hc_rx_packet_recv+0x139/0x1b0 net/dccp/ccids/ccid2.c:779
 ccid_hc_rx_packet_recv net/dccp/ccid.h:185 [inline]
 dccp_deliver_input_to_ccids+0xeb/0x270 net/dccp/input.c:180
 dccp_rcv_established net/dccp/input.c:378 [inline]
 dccp_rcv_established+0x83/0xb0 net/dccp/input.c:368
 dccp_v4_do_rcv+0x13f/0x190 net/dccp/ipv4.c:656
 sk_backlog_rcv include/net/sock.h:941 [inline]
 __sk_receive_skb+0x33c/0xbc0 net/core/sock.c:473
 dccp_v4_rcv+0xeb6/0x1b1d net/dccp/ipv4.c:877
 ip_local_deliver_finish+0x27e/0xc20 net/ipv4/ip_input.c:215
 NF_HOOK include/linux/netfilter.h:289 [inline]
 NF_HOOK include/linux/netfilter.h:283 [inline]
 ip_local_deliver+0x1e9/0x520 net/ipv4/ip_input.c:256
 dst_input include/net/dst.h:453 [inline]
 ip_rcv_finish+0x1d9/0x2e0 net/ipv4/ip_input.c:414
 NF_HOOK include/linux/netfilter.h:289 [inline]
 NF_HOOK include/linux/netfilter.h:283 [inline]
 ip_rcv+0xe8/0x3f0 net/ipv4/ip_input.c:524
 __netif_receive_skb_one_core+0x113/0x1a0 net/core/dev.c:4932
 __netif_receive_skb+0x2c/0x1d0 net/core/dev.c:5044
 process_backlog+0x23a/0x7a0 net/core/dev.c:5855
 napi_poll net/core/dev.c:6278 [inline]
 net_rx_action+0x4f5/0x1070 net/core/dev.c:6344
 __do_softirq+0x25c/0x921 kernel/softirq.c:292

Freed by task 7547:
 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
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcf/0x220 mm/slab.c:3822
 skb_free_head+0x99/0xc0 net/core/skbuff.c:554
 skb_release_data+0x57d/0x7d0 net/core/skbuff.c:574
 skb_release_all+0x4d/0x60 net/core/skbuff.c:631
 __kfree_skb net/core/skbuff.c:645 [inline]
 kfree_skb net/core/skbuff.c:663 [inline]
 kfree_skb+0xe8/0x390 net/core/skbuff.c:657
 dccp_v4_do_rcv net/dccp/ipv4.c:691 [inline]
 dccp_v4_do_rcv+0x166/0x190 net/dccp/ipv4.c:651
 sk_backlog_rcv include/net/sock.h:941 [inline]
 __release_sock+0x129/0x390 net/core/sock.c:2339
 release_sock+0x59/0x1c0 net/core/sock.c:2855
 dccp_sendmsg+0x683/0xd00 net/dccp/proto.c:818
 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_sendmsg+0x3e2/0x920 net/socket.c:2115
 __sys_sendmmsg+0x1bf/0x4e0 net/socket.c:2210
 __do_sys_sendmmsg net/socket.c:2239 [inline]
 __se_sys_sendmmsg net/socket.c:2236 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2236
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888081166540
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1186 bytes inside of
 2048-byte region [ffff888081166540, ffff888081166d40)
The buggy address belongs to the page:
page:ffffea0002045980 count:1 mapcount:0 mapping:ffff88812c3f0c40 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffffea000204f488 ffffea0002822408 ffff88812c3f0c40
raw: 0000000000000000 ffff888081166540 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888081166880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888081166900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888081166980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff888081166a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888081166a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/04 10:54 linux-4.19.y ef244c308885 b35fad31 .config console log report syz C ci2-linux-4-19
2019/11/04 10:19 linux-4.19.y ef244c308885 b35fad31 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.