syzbot


KASAN: use-after-free Read in ccid2_hc_tx_packet_recv

Status: upstream: reported C repro on 2018/04/02 09:20
Reported-by: syzbot+554ccde221001ab5479a@syzkaller.appspotmail.com
First crash: 1640d, last: 402d

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 (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 845d 1053d 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 1204d 1204d 0/1 auto-closed as invalid on 2019/10/25 08:37
linux-4.19 KASAN: use-after-free Read in ccid2_hc_tx_packet_recv C done error 2 839d 1059d 0/1 upstream: reported C repro on 2019/11/04 11:20
Patch testing requests:
Created Duration User Patch Repo Result
2022/09/17 00:29 11m upstream error
2021/06/23 19:42 9m rajatasthana4@gmail.com upstream report log

Sample crash report:
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+0x1b9/0x294 lib/dump_stack.c:113
==================================================================
 fail_dump lib/fault-inject.c:51 [inline]
 should_fail.cold.4+0xa/0x1a lib/fault-inject.c:149
BUG: KASAN: use-after-free in ccid2_hc_tx_packet_recv+0x2383/0x275e net/dccp/ccids/ccid2.c:597
Read of size 1 at addr ffff8801ba4911c2 by task syz-executor940/4542

 __should_failslab+0x124/0x180 mm/failslab.c:32
 should_failslab+0x9/0x14 mm/slab_common.c:1522
 slab_pre_alloc_hook mm/slab.h:423 [inline]
 slab_alloc mm/slab.c:3378 [inline]
 kmem_cache_alloc_trace+0x4b/0x780 mm/slab.c:3618
 kmalloc include/linux/slab.h:512 [inline]
 dccp_ackvec_parsed_add+0xa1/0x310 net/dccp/ackvec.c:352
 ccid2_hc_tx_parse_options+0x9a/0xb0 net/dccp/ccids/ccid2.c:510
 ccid_hc_tx_parse_options net/dccp/ccid.h:207 [inline]
 dccp_parse_options+0x658/0x11f0 net/dccp/options.c:233
 dccp_rcv_established+0x44/0xb0 net/dccp/input.c:374
 dccp_v4_do_rcv+0x153/0x180 net/dccp/ipv4.c:654
 sk_backlog_rcv include/net/sock.h:909 [inline]
 __release_sock+0x12f/0x3a0 net/core/sock.c:2335
 release_sock+0xa4/0x2b0 net/core/sock.c:2850
 dccp_sendmsg+0x771/0x1020 net/dccp/proto.c:820
 inet_sendmsg+0x19f/0x690 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:629 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:639
 ___sys_sendmsg+0x525/0x940 net/socket.c:2117
 __sys_sendmmsg+0x240/0x6f0 net/socket.c:2212
 __do_sys_sendmmsg net/socket.c:2241 [inline]
 __se_sys_sendmmsg net/socket.c:2238 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2238
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441819
RSP: 002b:00007ffdb9a9df08 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441819
RDX: 04000000000001e6 RSI: 0000000020000c00 RDI: 0000000000000005
RBP: 00007ffdb9a9df20 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 04000000000001e6 R14: 0000000000000006 R15: 0000000000000000
CPU: 0 PID: 4542 Comm: syz-executor940 Not tainted 4.17.0-rc6+ #66
dccp_parse_options: DCCP(        (ptrval)): Option 38 (len=1) error=5
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+0x1b9/0x294 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 ccid2_hc_tx_packet_recv+0x2383/0x275e net/dccp/ccids/ccid2.c:597
 ccid_hc_tx_packet_recv net/dccp/ccid.h:192 [inline]
 dccp_deliver_input_to_ccids+0x203/0x280 net/dccp/input.c:186
 dccp_rcv_established+0x87/0xb0 net/dccp/input.c:378
 dccp_v4_do_rcv+0x153/0x180 net/dccp/ipv4.c:654
 sk_backlog_rcv include/net/sock.h:909 [inline]
 __release_sock+0x12f/0x3a0 net/core/sock.c:2335
 release_sock+0xa4/0x2b0 net/core/sock.c:2850
 dccp_sendmsg+0x771/0x1020 net/dccp/proto.c:820
 inet_sendmsg+0x19f/0x690 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:629 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:639
 ___sys_sendmsg+0x525/0x940 net/socket.c:2117
 __sys_sendmmsg+0x240/0x6f0 net/socket.c:2212
 __do_sys_sendmmsg net/socket.c:2241 [inline]
 __se_sys_sendmmsg net/socket.c:2238 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2238
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441819
RSP: 002b:00007ffdb9a9df08 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441819
RDX: 04000000000001e6 RSI: 0000000020000c00 RDI: 0000000000000005
RBP: 00007ffdb9a9df20 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff
R13: 04000000000001e6 R14: 0000000000000006 R15: 0000000000000000

Allocated by task 4542:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node_track_caller+0x47/0x70 mm/slab.c:3696
 __kmalloc_reserve.isra.38+0x3a/0xe0 net/core/skbuff.c:137
 __alloc_skb+0x14d/0x780 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:987 [inline]
 dccp_send_ack+0xd2/0x340 net/dccp/output.c:580
 ccid2_hc_rx_packet_recv+0x139/0x1b0 net/dccp/ccids/ccid2.c:776
 ccid_hc_rx_packet_recv net/dccp/ccid.h:185 [inline]
 dccp_deliver_input_to_ccids+0xf0/0x280 net/dccp/input.c:180
 dccp_rcv_established+0x87/0xb0 net/dccp/input.c:378
 dccp_v4_do_rcv+0x153/0x180 net/dccp/ipv4.c:654
 sk_backlog_rcv include/net/sock.h:909 [inline]
 __sk_receive_skb+0x3a2/0xd60 net/core/sock.c:513
 dccp_v4_rcv+0x10e5/0x1f3f net/dccp/ipv4.c:875
 ip_local_deliver_finish+0x2e3/0xd80 net/ipv4/ip_input.c:215
 NF_HOOK include/linux/netfilter.h:288 [inline]
 ip_local_deliver+0x1e1/0x720 net/ipv4/ip_input.c:256
 dst_input include/net/dst.h:450 [inline]
 ip_rcv_finish+0x81b/0x2200 net/ipv4/ip_input.c:396
 NF_HOOK include/linux/netfilter.h:288 [inline]
 ip_rcv+0xb70/0x143d net/ipv4/ip_input.c:492
 __netif_receive_skb_core+0x26f5/0x3630 net/core/dev.c:4592
 __netif_receive_skb+0x2c/0x1e0 net/core/dev.c:4657
 process_backlog+0x219/0x760 net/core/dev.c:5337
 napi_poll net/core/dev.c:5735 [inline]
 net_rx_action+0x7b7/0x1930 net/core/dev.c:5801
 __do_softirq+0x2e0/0xaf5 kernel/softirq.c:285

Freed by task 4542:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 skb_free_head+0x99/0xc0 net/core/skbuff.c:550
 skb_release_data+0x690/0x860 net/core/skbuff.c:570
 skb_release_all+0x4a/0x60 net/core/skbuff.c:627
 __kfree_skb net/core/skbuff.c:641 [inline]
 kfree_skb+0x195/0x560 net/core/skbuff.c:659
 dccp_v4_do_rcv+0x12b/0x180 net/dccp/ipv4.c:689
 sk_backlog_rcv include/net/sock.h:909 [inline]
 __release_sock+0x12f/0x3a0 net/core/sock.c:2335
 release_sock+0xa4/0x2b0 net/core/sock.c:2850
 dccp_sendmsg+0x771/0x1020 net/dccp/proto.c:820
 inet_sendmsg+0x19f/0x690 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:629 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:639
 ___sys_sendmsg+0x525/0x940 net/socket.c:2117
 __sys_sendmmsg+0x240/0x6f0 net/socket.c:2212
 __do_sys_sendmmsg net/socket.c:2241 [inline]
 __se_sys_sendmmsg net/socket.c:2238 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2238
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801ba490d40
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1154 bytes inside of
 2048-byte region [ffff8801ba490d40, ffff8801ba491540)
The buggy address belongs to the page:
page:ffffea0006e92400 count:1 mapcount:0 mapping:ffff8801ba4904c0 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801ba4904c0 0000000000000000 0000000100000003
raw: ffffea0006ed9a20 ffffea0006fa5fa0 ffff8801da800c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801ba491080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801ba491100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801ba491180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff8801ba491200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801ba491280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (94):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2018/05/25 13:51 upstream b50694381cfc f48c20b8 .config log report syz C
ci-upstream-kasan-gce 2021/08/22 04:07 upstream 002c0aef1090 b599f2fc .config log report info KASAN: use-after-free Read in ccid2_hc_tx_packet_recv
ci-upstream-kasan-gce 2020/05/21 09:50 upstream b85051e755b0 c61086ab .config log report
ci-upstream-kasan-gce 2020/01/28 23:14 upstream c677124e631d c8e81ce4 .config log report
ci-upstream-kasan-gce 2020/01/25 04:48 upstream 6381b442836e 2e95ab33 .config log report
ci-upstream-kasan-gce-root 2020/01/15 23:46 upstream 51d69817519f f9b69507 .config log report
ci-upstream-kasan-gce 2019/09/14 02:20 upstream a7f89616b737 32d59357 .config log report
ci-upstream-kasan-gce 2019/08/22 00:58 upstream bb7ba8069de9 984250d5 .config log report
ci-upstream-kasan-gce 2019/08/07 21:39 upstream 33920f1ec5bf e6ebef88 .config log report
ci-upstream-kasan-gce-root 2019/06/26 03:41 upstream 249155c20f9b 0a8d1a96 .config log report
ci-upstream-kasan-gce-smack-root 2019/04/28 04:50 upstream 037904a22bf8 b617407b .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/26 18:38 upstream a3ac7917b730 55684ce1 .config log report
ci-upstream-kasan-gce 2019/02/14 01:51 upstream 1f947a7a011f 0a49c954 .config log report
ci-upstream-kasan-gce 2019/02/01 20:00 upstream 5b4746a03199 0c07abcf .config log report
ci-upstream-kasan-gce 2019/01/27 19:40 upstream ba6069759381 c73f090a .config log report
ci-upstream-kasan-gce-smack-root 2019/01/25 04:13 upstream c04e2a780caf bfab9cd8 .config log report
ci-upstream-kasan-gce 2019/01/19 01:04 upstream d7393226d15a 2103a236 .config log report
ci-upstream-kasan-gce 2019/01/12 02:08 upstream de6629eb262e c3f3344c .config log report
ci-upstream-kasan-gce 2019/01/08 05:39 upstream 3bd6e94bec12 69d69aa9 .config log report
ci-upstream-kasan-gce 2019/01/06 05:58 upstream f1c2f8857c5a 53be0a37 .config log report
ci-upstream-kasan-gce 2018/12/30 20:45 upstream 195303136f19 9942de5f .config log report
ci-upstream-kasan-gce 2018/12/24 15:29 upstream 8fe28cb58bcb be79df56 .config log report
ci-upstream-kasan-gce 2018/12/19 03:26 upstream ddfbab46539f 4edaba93 .config log report
ci-upstream-kasan-gce-root 2018/04/05 00:18 upstream 3e968c9f1401 676bd07e .config log report
ci-upstream-kasan-gce-386 2019/08/12 05:22 upstream 296d05cb0d3c acb51638 .config log report
ci-upstream-kasan-gce-386 2018/04/02 00:13 upstream 0adb32858b0b dc889257 .config log report
ci-upstream-net-this-kasan-gce 2019/10/02 07:01 net 569aad4fcd82 b7a87a83 .config log report
ci-upstream-net-this-kasan-gce 2019/08/08 02:40 net 33920f1ec5bf e6ebef88 .config log report
ci-upstream-net-this-kasan-gce 2019/05/02 06:55 net d2f0c961148f 7516d9fa .config log report
ci-upstream-net-this-kasan-gce 2019/04/29 18:48 net 2ae7a39770c7 b617407b .config log report
ci-upstream-net-this-kasan-gce 2018/12/23 21:59 net a3ac5817ffe8 e3bd7ab8 .config log report
ci-upstream-net-kasan-gce 2020/06/23 16:07 net-next cb8e59cc8720 54566aff .config log report
ci-upstream-net-kasan-gce 2020/05/20 19:52 net-next 4f65e2f483b6 1255f02a .config log report
ci-upstream-net-kasan-gce 2020/03/17 17:34 net-next 86e85bf6981c 749688d2 .config log report
ci-upstream-net-kasan-gce 2019/12/21 21:35 net-next 994baea28957 bc586918 .config log report
ci-upstream-net-kasan-gce 2019/12/11 00:29 net-next 08cbc75f9602 5a5826a1 .config log report
ci-upstream-net-kasan-gce 2019/11/15 04:14 net-next abfb228ae642 a24fe792 .config log report
ci-upstream-net-kasan-gce 2019/10/14 23:41 net-next 7e0d15ee0d8b 05ad7292 .config log report
ci-upstream-net-kasan-gce 2019/09/02 01:03 net-next 4bc61b0b1695 bad3cce2 .config log report
ci-upstream-net-kasan-gce 2019/08/10 21:36 net-next 38b9e0f6d981 acb51638 .config log report
ci-upstream-net-kasan-gce 2019/06/27 09:51 net-next 177d935a1370 7509bf36 .config log report
ci-upstream-net-kasan-gce 2019/05/11 03:38 net-next b970afcfcabd 46caad94 .config log report
ci-upstream-net-kasan-gce 2019/04/28 14:10 net-next b1a79360ee86 b617407b .config log report
ci-upstream-net-kasan-gce 2019/04/26 22:49 net-next 148f025d41a8 b617407b .config log report
ci-upstream-net-kasan-gce 2019/04/23 23:22 net-next a93f7fe13454 4d3d6a50 .config log report
ci-upstream-net-kasan-gce 2019/04/21 19:54 net-next 4e54507ab1a9 b0e8efcb .config log report
ci-upstream-net-kasan-gce 2019/04/19 06:33 net-next 5e42574b022b b0e8efcb .config log report
ci-upstream-net-kasan-gce 2019/04/17 20:24 net-next 3a6f7892acc1 b0e8efcb .config log report
ci-upstream-net-kasan-gce 2019/04/15 07:07 net-next 0ed1d3ddedb9 505ab413 .config log report
ci-upstream-net-kasan-gce 2019/04/07 23:08 net-next f1054c65bca6 c34fde03 .config log report
ci-upstream-net-kasan-gce 2019/03/29 00:23 net-next 356d71e00d27 14c58f8d .config log report
ci-upstream-net-kasan-gce 2019/02/02 00:59 net-next 962c382d482a 564f9a4f .config log report
ci-upstream-net-kasan-gce 2019/01/19 17:26 net-next f04d402f2f00 8aa587b0 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/09/08 08:29 linux-next 6d028043b55e a60cb4cd .config log report
* Struck through repros no longer work on HEAD.