syzbot


KASAN: use-after-free Write in tcp_cdg_cwnd_event (2)

Status: auto-closed as invalid on 2022/09/20 12:00
Subsystems: net
[Documentation on labels]
First crash: 951d, last: 951d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in tcp_cdg_cwnd_event net 2 1076d 1159d 0/28 auto-closed as invalid on 2022/05/18 11:54

Sample crash report:
==================================================================
==================================================================
BUG: KASAN: use-after-free in tcp_cdg_cwnd_event+0x134/0x2b0 net/ipv4/tcp_cdg.c:355
Write of size 64 at addr ffff888079440580 by task kworker/0:1/14

CPU: 0 PID: 14 Comm: kworker/0:1 Not tainted 5.19.0-rc3-syzkaller-00038-gca1fdab7fd27 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events mptcp_worker
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x65/0x4b0 mm/kasan/report.c:313
 print_report+0xf4/0x210 mm/kasan/report.c:429
 kasan_report+0xfb/0x130 mm/kasan/report.c:491
 kasan_check_range+0x2a7/0x2e0 mm/kasan/generic.c:189
 memset+0x1f/0x40 mm/kasan/shadow.c:44
 tcp_cdg_cwnd_event+0x134/0x2b0 net/ipv4/tcp_cdg.c:355
 tcp_ca_event include/net/tcp.h:1150 [inline]
 tcp_cwnd_restart+0x134/0x4c0 net/ipv4/tcp_output.c:148
 __mptcp_alloc_tx_skb net/mptcp/protocol.c:1202 [inline]
 mptcp_alloc_tx_skb+0x265/0x4a0 net/mptcp/protocol.c:1220
 mptcp_sendmsg_frag+0x582/0x2680 net/mptcp/protocol.c:1301
 __mptcp_push_pending+0x35d/0xaa0 net/mptcp/protocol.c:1595
 mptcp_release_cb+0x740/0xc20 net/mptcp/protocol.c:3150
 release_sock+0xaf/0x1c0 net/core/sock.c:3410
 mptcp_worker+0x924/0xe40 net/mptcp/protocol.c:2581
 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289
 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436
 kthread+0x266/0x300 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30
 </TASK>

Allocated by task 10276:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:436 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:515
 kasan_kmalloc include/linux/kasan.h:234 [inline]
 __kmalloc+0x223/0x370 mm/slub.c:4446
 kmalloc_array include/linux/slab.h:640 [inline]
 kcalloc include/linux/slab.h:671 [inline]
 tcp_cdg_init+0x46/0x140 net/ipv4/tcp_cdg.c:380
 tcp_init_congestion_control+0x97/0x5d0 net/ipv4/tcp_cong.c:193
 tcp_reinit_congestion_control net/ipv4/tcp_cong.c:217 [inline]
 tcp_set_congestion_control+0x76b/0xa30 net/ipv4/tcp_cong.c:391
 do_tcp_setsockopt net/ipv4/tcp.c:3390 [inline]
 tcp_setsockopt+0x629/0x3760 net/ipv4/tcp.c:3677
 mptcp_setsockopt+0x2aa1/0x3a20 net/mptcp/sockopt.c:828
 __sys_setsockopt+0x65d/0xa00 net/socket.c:2259
 __do_sys_setsockopt net/socket.c:2270 [inline]
 __se_sys_setsockopt net/socket.c:2267 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2267
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0

Freed by task 5317:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0xd8/0x110 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:200 [inline]
 slab_free_hook mm/slub.c:1754 [inline]
 slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1780
 slab_free mm/slub.c:3536 [inline]
 kfree+0xc6/0x210 mm/slub.c:4584
 tcp_cleanup_congestion_control+0x69/0xf0 net/ipv4/tcp_cong.c:226
 tcp_v4_destroy_sock+0xfc/0x520 net/ipv4/tcp_ipv4.c:2226
 tcp_v6_destroy_sock+0x11/0x20 net/ipv6/tcp_ipv6.c:1944
 inet_csk_destroy_sock+0x155/0x390 net/ipv4/inet_connection_sock.c:1011
 tcp_reset+0xfb/0x1b0 net/ipv4/tcp_input.c:4318
 tcp_validate_incoming+0xa39/0x2170 net/ipv4/tcp_input.c:5787
 tcp_rcv_established+0x7b4/0x1a10 net/ipv4/tcp_input.c:5972
 tcp_v6_do_rcv+0x563/0x1270 net/ipv6/tcp_ipv6.c:1476
 tcp_v6_rcv+0x23ef/0x2c10 net/ipv6/tcp_ipv6.c:1735
 ip6_protocol_deliver_rcu+0x9c5/0x1360 net/ipv6/ip6_input.c:436
 ip6_input_finish+0x140/0x260 net/ipv6/ip6_input.c:481
 ip_sabotage_in+0x1a9/0x210 net/bridge/br_netfilter_hooks.c:872
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:620
 nf_hook+0x235/0x3a0 include/linux/netfilter.h:262
 NF_HOOK include/linux/netfilter.h:305 [inline]
 ipv6_rcv+0x87/0xd0 net/ipv6/ip6_input.c:306
 __netif_receive_skb_one_core net/core/dev.c:5478 [inline]
 __netif_receive_skb+0x1c5/0x500 net/core/dev.c:5592
 netif_receive_skb_internal+0x108/0x360 net/core/dev.c:5678
 netif_receive_skb+0x19/0x30 net/core/dev.c:5737
 br_handle_frame_finish+0x136c/0x1810
 br_nf_hook_thresh+0x3ee/0x500 net/bridge/br_netfilter_hooks.c:1024
 br_nf_pre_routing_finish_ipv6+0x94a/0xbd0
 NF_HOOK include/linux/netfilter.h:307 [inline]
 br_nf_pre_routing_ipv6+0x294/0x340 net/bridge/br_netfilter_ipv6.c:236
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_bridge_pre net/bridge/br_input.c:255 [inline]
 br_handle_frame+0x8c5/0x10e0 net/bridge/br_input.c:399
 __netif_receive_skb_core+0x1448/0x3c00 net/core/dev.c:5372
 __netif_receive_skb_one_core net/core/dev.c:5476 [inline]
 __netif_receive_skb+0x11a/0x500 net/core/dev.c:5592
 process_backlog+0x4f8/0x8b0 net/core/dev.c:5920
 __napi_poll+0xbe/0x4b0 net/core/dev.c:6486
 napi_poll net/core/dev.c:6553 [inline]
 net_rx_action+0x76c/0x10b0 net/core/dev.c:6664
 __do_softirq+0x382/0x793 kernel/softirq.c:571

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:348
 call_rcu+0x163/0x9c0 kernel/rcu/tree.c:3126
 mpls_dev_notify+0x658/0x750 net/mpls/af_mpls.c:1655
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0xe7/0x170 kernel/notifier.c:455
 call_netdevice_notifiers_info net/core/dev.c:1943 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:1981 [inline]
 call_netdevice_notifiers net/core/dev.c:1995 [inline]
 unregister_netdevice_many+0xeee/0x1950 net/core/dev.c:10834
 ip_tunnel_delete_nets+0x325/0x370 net/ipv4/ip_tunnel.c:1124
 ops_exit_list net/core/net_namespace.c:167 [inline]
 cleanup_net+0x80c/0xc50 net/core/net_namespace.c:594
 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289
 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436
 kthread+0x266/0x300 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30

The buggy address belongs to the object at ffff888079440580
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff888079440580, ffff8880794405c0)

The buggy address belongs to the physical page:
page:ffffea0001e51000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x79440
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000001 ffff888011c41640
raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 3665, tgid 3665 (udevd), ts 155049609720, free_ts 155007805044
 prep_new_page mm/page_alloc.c:2456 [inline]
 get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4198
 __alloc_pages+0x259/0x560 mm/page_alloc.c:5426
 alloc_slab_page+0x70/0xf0 mm/slub.c:1824
 allocate_slab+0x5e/0x520 mm/slub.c:1969
 new_slab mm/slub.c:2029 [inline]
 ___slab_alloc+0x42e/0xce0 mm/slub.c:3031
 __slab_alloc mm/slub.c:3118 [inline]
 slab_alloc_node mm/slub.c:3209 [inline]
 slab_alloc mm/slub.c:3251 [inline]
 __kmalloc+0x2ba/0x370 mm/slub.c:4442
 kmalloc include/linux/slab.h:605 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
 tomoyo_encode+0x26f/0x540 security/tomoyo/realpath.c:80
 tomoyo_realpath_from_path+0x5b4/0x5f0 security/tomoyo/realpath.c:288
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_path_perm+0x270/0x6b0 security/tomoyo/file.c:822
 security_inode_getattr+0xc0/0x140 security/security.c:1344
 vfs_getattr+0x26/0x360 fs/stat.c:157
 vfs_statx+0x183/0x3f0 fs/stat.c:232
 vfs_fstatat fs/stat.c:255 [inline]
 __do_sys_newfstatat fs/stat.c:425 [inline]
 __se_sys_newfstatat+0xf6/0x790 fs/stat.c:419
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1371 [inline]
 free_pcp_prepare+0x812/0x900 mm/page_alloc.c:1421
 free_unref_page_prepare mm/page_alloc.c:3343 [inline]
 free_unref_page+0x7d/0x390 mm/page_alloc.c:3438
 do_slab_free mm/slub.c:3524 [inline]
 ___cache_free+0x118/0x1a0 mm/slub.c:3543
 qlist_free_all+0x2b/0x70 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x169/0x180 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:446
 kasan_slab_alloc include/linux/kasan.h:224 [inline]
 slab_post_alloc_hook mm/slab.h:750 [inline]
 slab_alloc_node mm/slub.c:3243 [inline]
 kmem_cache_alloc_node+0x1cd/0x340 mm/slub.c:3293
 __alloc_skb+0xd5/0x660 net/core/skbuff.c:414
 alloc_skb include/linux/skbuff.h:1426 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1191 [inline]
 netlink_sendmsg+0x774/0xcd0 net/netlink/af_netlink.c:1896
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg net/socket.c:734 [inline]
 __sys_sendto+0x439/0x5c0 net/socket.c:2119
 __do_sys_sendto net/socket.c:2131 [inline]
 __se_sys_sendto net/socket.c:2127 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2127
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0

Memory state around the buggy address:
 ffff888079440480: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff888079440500: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
>ffff888079440580: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff888079440600: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
 ffff888079440680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/06/22 11:59 upstream ca1fdab7fd27 0fc5c330 .config console log report info ci-upstream-kasan-gce-smack-root KASAN: use-after-free Write in tcp_cdg_cwnd_event
* Struck through repros no longer work on HEAD.