syzbot


KASAN: use-after-free Read in ccid2_hc_tx_packet_recv

Status: upstream: reported C repro on 2024/11/04 02:55
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+2a6e8fee8d682262a034@syzkaller.appspotmail.com
First crash: 40d, last: 40d
Bug presence (1)
Date Name Commit Repro Result
2024/11/10 upstream (ToT) de2f378f2b77 C [report] KASAN: slab-use-after-free Read in ccid2_hc_tx_packet_recv
Similar bugs (4)
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 1653d 1861d 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 2012d 2012d 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 107 17d 2447d 0/28 upstream: reported C repro on 2018/04/02 09:20
linux-4.19 KASAN: use-after-free Read in ccid2_hc_tx_packet_recv C done error 2 1646d 1866d 0/1 upstream: reported C repro on 2019/11/04 11:20

Sample crash report:
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
dccp_parse_options: DCCP(00000000403ed58e): Option 32 (len=7) error=9
==================================================================
BUG: KASAN: use-after-free in dccp_ackvec_runlen net/dccp/ackvec.h:43 [inline]
BUG: KASAN: use-after-free in ccid2_hc_tx_packet_recv+0x1498/0x1af0 net/dccp/ccids/ccid2.c:592
Read of size 1 at addr ffff0000d5996494 by task syz-executor122/4289

CPU: 0 PID: 4289 Comm: syz-executor122 Not tainted 6.1.115-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:395
 kasan_report+0xd4/0x130 mm/kasan/report.c:495
 __asan_report_load1_noabort+0x2c/0x38 mm/kasan/report_generic.c:348
 dccp_ackvec_runlen net/dccp/ackvec.h:43 [inline]
 ccid2_hc_tx_packet_recv+0x1498/0x1af0 net/dccp/ccids/ccid2.c:592
 ccid_hc_tx_packet_recv net/dccp/ccid.h:189 [inline]
 dccp_deliver_input_to_ccids net/dccp/input.c:182 [inline]
 dccp_rcv_established+0x26c/0x2d8 net/dccp/input.c:374
 dccp_v6_do_rcv+0x248/0x938 net/dccp/ipv6.c:622
 sk_backlog_rcv include/net/sock.h:1119 [inline]
 __release_sock+0x1a8/0x408 net/core/sock.c:2936
 release_sock+0x68/0x1cc net/core/sock.c:3500
 dccp_sendmsg+0x46c/0xb80 net/dccp/proto.c:800
 inet_sendmsg+0x15c/0x290 net/ipv4/af_inet.c:843
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 ____sys_sendmsg+0x55c/0x848 net/socket.c:2519
 ___sys_sendmsg net/socket.c:2573 [inline]
 __sys_sendmmsg+0x318/0x7d8 net/socket.c:2659
 __do_sys_sendmmsg net/socket.c:2688 [inline]
 __se_sys_sendmmsg net/socket.c:2685 [inline]
 __arm64_sys_sendmmsg+0xa0/0xbc net/socket.c:2685
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Allocated by task 4289:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:936 [inline]
 __kmalloc_node_track_caller+0xd0/0x1c0 mm/slab_common.c:956
 kmalloc_reserve net/core/skbuff.c:446 [inline]
 __alloc_skb+0x180/0x580 net/core/skbuff.c:515
 alloc_skb include/linux/skbuff.h:1271 [inline]
 dccp_send_ack+0xa4/0x2bc net/dccp/output.c:585
 ccid2_hc_rx_packet_recv+0x114/0x1b8 net/dccp/ccids/ccid2.c:771
 ccid_hc_rx_packet_recv net/dccp/ccid.h:182 [inline]
 dccp_deliver_input_to_ccids net/dccp/input.c:176 [inline]
 dccp_rcv_established+0x1ac/0x2d8 net/dccp/input.c:374
 dccp_v6_do_rcv+0x248/0x938 net/dccp/ipv6.c:622
 sk_backlog_rcv include/net/sock.h:1119 [inline]
 __sk_receive_skb+0x3f8/0x900 net/core/sock.c:569
 dccp_v6_rcv+0xbac/0x10b8 net/dccp/ipv6.c:791
 ip6_protocol_deliver_rcu+0x958/0x1214 net/ipv6/ip6_input.c:438
 ip6_input_finish+0x164/0x298 net/ipv6/ip6_input.c:483
 NF_HOOK+0x328/0x3d4 include/linux/netfilter.h:302
 ip6_input+0x70/0x84 net/ipv6/ip6_input.c:492
 dst_input include/net/dst.h:454 [inline]
 ip6_rcv_finish+0x1f4/0x220 net/ipv6/ip6_input.c:79
 NF_HOOK+0x328/0x3d4 include/linux/netfilter.h:302
 ipv6_rcv+0x98/0xb8 net/ipv6/ip6_input.c:310
 __netif_receive_skb_one_core net/core/dev.c:5532 [inline]
 __netif_receive_skb+0x18c/0x400 net/core/dev.c:5646
 process_backlog+0x410/0x784 net/core/dev.c:5974
 __napi_poll+0xb4/0x3f0 net/core/dev.c:6541
 napi_poll net/core/dev.c:6608 [inline]
 net_rx_action+0x5cc/0xd3c net/core/dev.c:6722
 handle_softirqs+0x318/0xd58 kernel/softirq.c:571
 __do_softirq+0x14/0x20 kernel/softirq.c:605

Freed by task 4289:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:988
 skb_free_head net/core/skbuff.c:762 [inline]
 skb_release_data+0x488/0x6b0 net/core/skbuff.c:791
 skb_release_all net/core/skbuff.c:856 [inline]
 __kfree_skb net/core/skbuff.c:870 [inline]
 kfree_skb_reason+0x1a4/0x47c net/core/skbuff.c:893
 dccp_v6_do_rcv+0x12c/0x938
 sk_backlog_rcv include/net/sock.h:1119 [inline]
 __release_sock+0x1a8/0x408 net/core/sock.c:2936
 release_sock+0x68/0x1cc net/core/sock.c:3500
 dccp_sendmsg+0x46c/0xb80 net/dccp/proto.c:800
 inet_sendmsg+0x15c/0x290 net/ipv4/af_inet.c:843
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 ____sys_sendmsg+0x55c/0x848 net/socket.c:2519
 ___sys_sendmsg net/socket.c:2573 [inline]
 __sys_sendmmsg+0x318/0x7d8 net/socket.c:2659
 __do_sys_sendmmsg net/socket.c:2688 [inline]
 __se_sys_sendmmsg net/socket.c:2685 [inline]
 __arm64_sys_sendmmsg+0xa0/0xbc net/socket.c:2685
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000d5996000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1172 bytes inside of
 2048-byte region [ffff0000d5996000, ffff0000d5996800)

The buggy address belongs to the physical page:
page:000000002f2dee18 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x115990
head:000000002f2dee18 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 fffffc0003590000 dead000000000002 ffff0000c0002900
raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d5996380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d5996400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000d5996480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff0000d5996500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d5996580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/04 05:00 linux-6.1.y 7c15117f9468 f00eed24 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ccid2_hc_tx_packet_recv
2024/11/04 04:23 linux-6.1.y 7c15117f9468 f00eed24 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ccid2_hc_tx_packet_recv
2024/11/04 03:46 linux-6.1.y 7c15117f9468 f00eed24 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ccid2_hc_tx_packet_recv
2024/11/04 02:54 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in ccid2_hc_tx_packet_recv
* Struck through repros no longer work on HEAD.