syzbot


KASAN: use-after-free Read in ovs_ct_exit

Status: upstream: reported on 2024/01/23 22:11
Reported-by: syzbot+26577a1b7bc1084a314c@syzkaller.appspotmail.com
First crash: 103d, last: 29d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ovs_ct_exit openvswitch 1 1364d 1363d 0/26 auto-closed as invalid on 2020/12/08 16:36
upstream KASAN: use-after-free Read in ovs_ct_exit (2) openvswitch 21 606d 975d 0/26 auto-obsoleted due to no activity on 2023/01/05 07:06
upstream KASAN: slab-use-after-free Read in ovs_ct_exit openvswitch 6 13d 39d 0/26 upstream: reported on 2024/03/27 21:46

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ovs_ct_exit+0x100/0x200 net/openvswitch/conntrack.c:2310
Read of size 8 at addr ffff8880236ceb80 by task kworker/u4:4/3570

CPU: 1 PID: 3570 Comm: kworker/u4:4 Not tainted 5.15.153-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: netns cleanup_net
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 ovs_ct_exit+0x100/0x200 net/openvswitch/conntrack.c:2310
 ovs_exit_net+0xea/0x7c0 net/openvswitch/datapath.c:2626
 ops_exit_list net/core/net_namespace.c:169 [inline]
 cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:596
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
 </TASK>

Allocated by task 5843:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
 kmalloc include/linux/slab.h:591 [inline]
 ovs_ct_limit_set_zone_limit net/openvswitch/conntrack.c:1979 [inline]
 ovs_ct_limit_cmd_set+0x2e0/0xad0 net/openvswitch/conntrack.c:2155
 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
 genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485
 __sys_sendmsg net/socket.c:2514 [inline]
 __do_sys_sendmsg net/socket.c:2523 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2521
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 3861:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free_bulk+0x28f/0x4c0 mm/slub.c:3640
 kfree_bulk include/linux/slab.h:448 [inline]
 kfree_rcu_work+0x332/0x7a0 kernel/rcu/tree.c:3295
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 kvfree_call_rcu+0x118/0x8a0 kernel/rcu/tree.c:3596
 ovs_ct_limit_exit net/openvswitch/conntrack.c:1918 [inline]
 ovs_ct_exit+0xeb/0x200 net/openvswitch/conntrack.c:2310
 ovs_exit_net+0xea/0x7c0 net/openvswitch/datapath.c:2626
 ops_exit_list net/core/net_namespace.c:169 [inline]
 cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:596
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 kvfree_call_rcu+0x118/0x8a0 kernel/rcu/tree.c:3596
 sctp_bind_addr_clean net/sctp/bind_addr.c:131 [inline]
 sctp_bind_addr_free+0x136/0x170 net/sctp/bind_addr.c:140
 sctp_association_free+0x288/0x7b0 net/sctp/associola.c:358
 sctp_cmd_delete_tcb net/sctp/sm_sideeffect.c:944 [inline]
 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1331 [inline]
 sctp_side_effects net/sctp/sm_sideeffect.c:1199 [inline]
 sctp_do_sm+0x3c58/0x5c80 net/sctp/sm_sideeffect.c:1170
 sctp_primitive_ABORT+0x94/0xc0 net/sctp/primitive.c:104
 sctp_sendmsg_check_sflags+0x1e4/0x2c0 net/sctp/socket.c:1778
 sctp_sendmsg+0x1dfa/0x3370 net/sctp/socket.c:2022
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2431
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2485
 __sys_sendmmsg+0x2bf/0x560 net/socket.c:2571
 __do_sys_sendmmsg net/socket.c:2600 [inline]
 __se_sys_sendmmsg net/socket.c:2597 [inline]
 __x64_sys_sendmmsg+0x9c/0xb0 net/socket.c:2597
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff8880236ceb80
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff8880236ceb80, ffff8880236cebc0)
The buggy address belongs to the page:
page:ffffea00008db380 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x236ce
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00008e2cc0 0000000600000003 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 15654282041, free_ts 15648435243
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc_trace+0x1a0/0x290 mm/slub.c:3245
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 dropmon_net_event+0x16a/0x3f0 net/core/drop_monitor.c:1568
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2018 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2030 [inline]
 call_netdevice_notifiers+0x145/0x1b0 net/core/dev.c:2044
 register_netdevice+0x12e8/0x1720 net/core/dev.c:10388
 register_netdev+0x37/0x50 net/core/dev.c:10481
 nr_proto_init+0x16f/0x822 net/netrom/af_netrom.c:1424
 do_one_initcall+0x22b/0x7a0 init/main.c:1300
 do_initcall_level+0x157/0x207 init/main.c:1373
 do_initcalls+0x49/0x86 init/main.c:1389
 kernel_init_freeable+0x425/0x5b5 init/main.c:1613
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 __vunmap+0x8d4/0xa20 mm/vmalloc.c:2621
 free_work+0x57/0x80 mm/vmalloc.c:95
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Memory state around the buggy address:
 ffff8880236cea80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
 ffff8880236ceb00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
>ffff8880236ceb80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff8880236cec00: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
 ffff8880236cec80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/06 02:57 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ovs_ct_exit
2024/03/28 14:05 linux-5.15.y 9465fef4ae35 e91187ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ovs_ct_exit
2024/01/23 22:10 linux-5.15.y ddcaf4999061 1e153dc8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ovs_ct_exit
* Struck through repros no longer work on HEAD.