syzbot


KASAN: use-after-free Read in ovs_ct_exit (2)
Status: upstream: reported on 2021/09/03 08:20
Reported-by: syzbot+5287ee27c6da3ab2d054@syzkaller.appspotmail.com
First crash: 272d, last: 71d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in ovs_ct_exit 1 655d 654d 0/22 auto-closed as invalid on 2020/12/08 16:36

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ovs_ct_exit+0x113/0x220 net/openvswitch/conntrack.c:2314
Read of size 8 at addr ffff888019e1e980 by task kworker/u4:2/50

CPU: 0 PID: 50 Comm: kworker/u4:2 Not tainted 5.16.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106
 print_address_description+0x65/0x3a0 mm/kasan/report.c:255
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report+0x19a/0x1f0 mm/kasan/report.c:459
 ovs_ct_exit+0x113/0x220 net/openvswitch/conntrack.c:2314
 ovs_exit_net+0xea/0x830 net/openvswitch/datapath.c:2608
 ops_exit_list net/core/net_namespace.c:168 [inline]
 cleanup_net+0x758/0xc70 net/core/net_namespace.c:597
 process_one_work+0x850/0x1130 kernel/workqueue.c:2307
 worker_thread+0xab1/0x1300 kernel/workqueue.c:2454
 kthread+0x2a3/0x2d0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30
 </TASK>

Allocated by task 23464:
 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:437 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:516
 kasan_kmalloc include/linux/kasan.h:270 [inline]
 kmem_cache_alloc_trace+0x9d/0x330 mm/slub.c:3257
 kmalloc include/linux/slab.h:581 [inline]
 ovs_ct_limit_set_zone_limit net/openvswitch/conntrack.c:1983 [inline]
 ovs_ct_limit_cmd_set+0x2e0/0xaa0 net/openvswitch/conntrack.c:2159
 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
 genl_rcv_msg+0x1032/0x1480 net/netlink/genetlink.c:792
 netlink_rcv_skb+0x200/0x470 net/netlink/af_netlink.c:2494
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
 netlink_unicast+0x81a/0x9f0 net/netlink/af_netlink.c:1343
 netlink_sendmsg+0xaec/0xe60 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:705 [inline]
 sock_sendmsg net/socket.c:725 [inline]
 ____sys_sendmsg+0x5b9/0x910 net/socket.c:2413
 ___sys_sendmsg net/socket.c:2467 [inline]
 __sys_sendmsg+0x280/0x370 net/socket.c:2496
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 5355:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x180 mm/kasan/common.c:367
 kasan_slab_free include/linux/kasan.h:236 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1754
 slab_free mm/slub.c:3509 [inline]
 kmem_cache_free_bulk+0x2b7/0x520 mm/slub.c:3656
 kfree_bulk include/linux/slab.h:437 [inline]
 kfree_rcu_work+0x38b/0x820 kernel/rcu/tree.c:3314
 process_one_work+0x850/0x1130 kernel/workqueue.c:2307
 worker_thread+0xab1/0x1300 kernel/workqueue.c:2454
 kthread+0x2a3/0x2d0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:348
 kvfree_call_rcu+0x119/0x880 kernel/rcu/tree.c:3591
 ovs_ct_limit_exit net/openvswitch/conntrack.c:1922 [inline]
 ovs_ct_exit+0xfe/0x220 net/openvswitch/conntrack.c:2314
 ovs_exit_net+0xea/0x830 net/openvswitch/datapath.c:2608
 ops_exit_list net/core/net_namespace.c:168 [inline]
 cleanup_net+0x758/0xc70 net/core/net_namespace.c:597
 process_one_work+0x850/0x1130 kernel/workqueue.c:2307
 worker_thread+0xab1/0x1300 kernel/workqueue.c:2454
 kthread+0x2a3/0x2d0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30

The buggy address belongs to the object at ffff888019e1e980
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff888019e1e980, ffff888019e1e9c0)
The buggy address belongs to the page:
page:ffffea0000678780 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888019e1ef80 pfn:0x19e1e
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea000058f008 ffffea0001ede1c8 ffff888011441640
raw: ffff888019e1ef80 000000000020001d 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 3966, ts 219777911274, free_ts 219694149177
 prep_new_page mm/page_alloc.c:2434 [inline]
 get_page_from_freelist+0x729/0x9e0 mm/page_alloc.c:4165
 __alloc_pages+0x255/0x580 mm/page_alloc.c:5389
 alloc_slab_page mm/slub.c:1799 [inline]
 allocate_slab+0xce/0x3f0 mm/slub.c:1944
 new_slab mm/slub.c:2004 [inline]
 ___slab_alloc+0x3fe/0xc30 mm/slub.c:3018
 __slab_alloc mm/slub.c:3105 [inline]
 slab_alloc_node mm/slub.c:3196 [inline]
 slab_alloc mm/slub.c:3238 [inline]
 kmem_cache_alloc_trace+0x28c/0x330 mm/slub.c:3255
 kmalloc include/linux/slab.h:581 [inline]
 dccp_feat_entry_new+0x1d7/0x450 net/dccp/feat.c:464
 dccp_feat_push_change net/dccp/feat.c:484 [inline]
 __feat_register_sp+0x2e9/0x510 net/dccp/feat.c:740
 dccp_feat_init+0xd10/0xf70 net/dccp/feat.c:1502
 dccp_v6_init_sock+0x19/0x80 net/dccp/ipv6.c:1012
 inet6_create+0xb02/0xe90 net/ipv6/af_inet6.c:257
 __sock_create+0x580/0x8d0 net/socket.c:1468
 sock_create net/socket.c:1519 [inline]
 __sys_socket+0x133/0x380 net/socket.c:1561
 __do_sys_socket net/socket.c:1570 [inline]
 __se_sys_socket net/socket.c:1568 [inline]
 __x64_sys_socket+0x76/0x80 net/socket.c:1568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1352 [inline]
 free_pcp_prepare+0xd1c/0xe00 mm/page_alloc.c:1404
 free_unref_page_prepare mm/page_alloc.c:3325 [inline]
 free_unref_page_list+0x11f/0xa50 mm/page_alloc.c:3441
 release_pages+0x15a7/0x17d0 mm/swap.c:980
 tlb_batch_pages_flush mm/mmu_gather.c:50 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:243 [inline]
 tlb_flush_mmu+0x780/0x910 mm/mmu_gather.c:250
 tlb_finish_mmu+0xcb/0x200 mm/mmu_gather.c:341
 exit_mmap+0x402/0x740 mm/mmap.c:3180
 __mmput+0x111/0x3a0 kernel/fork.c:1114
 exit_mm+0x211/0x2f0 kernel/exit.c:507
 do_exit+0x5be/0x2140 kernel/exit.c:793
 do_group_exit+0x2af/0x2b0 kernel/exit.c:935
 get_signal+0x1831/0x2330 kernel/signal.c:2862
 arch_do_signal_or_restart+0x9c/0x730 arch/x86/kernel/signal.c:868
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
 exit_to_user_mode_prepare+0x191/0x220 kernel/entry/common.c:207
 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
 syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:300
 do_syscall_64+0x53/0xd0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
 ffff888019e1e880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888019e1e900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888019e1e980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff888019e1ea00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888019e1ea80: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (17):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2022/01/22 17:56 upstream 0809edbae347 214351e1 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-kasan-gce-selinux-root 2021/12/24 12:32 upstream 7a29b11da965 6caa12e4 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-kasan-gce-selinux-root 2021/12/11 13:59 upstream 6f513529296f 49ca1f59 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-kasan-gce-selinux-root 2021/11/27 07:24 upstream c5c17547b778 63eeac02 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-kasan-gce-selinux-root 2021/11/25 01:04 upstream 5f53fa508db0 545ab074 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-kasan-gce-selinux-root 2021/10/18 08:56 upstream cf52ad5ff16c 0c5d9412 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-kasan-gce-selinux-root 2021/10/16 16:26 upstream 8fe31e0995f0 0c5d9412 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-kasan-gce 2022/03/17 13:53 bpf 18b1ab7aa76b dfa9a8ed .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-kasan-gce 2022/02/25 20:44 bpf 8940e6b669ca 45a13a73 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-kasan-gce 2021/12/20 23:47 bpf 819d11507f66 62bd192b .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-kasan-gce 2021/10/23 21:05 bpf 04f8ef5643bc 282f03fb .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-kasan-gce 2021/10/20 00:18 bpf 732b74d64704 466b7db1 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-kasan-gce 2021/10/12 14:55 bpf 732b74d64704 838e7e2c .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-net-this-kasan-gce 2021/08/28 12:52 net 0d55649d2ad7 be2c130d .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-next-kasan-gce 2021/12/19 18:19 bpf-next 4b443bc1785f 44068e19 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-next-kasan-gce 2021/10/19 18:27 bpf-next 223f903e9c83 466b7db1 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-next-kasan-gce 2021/10/11 14:10 bpf-next 431bfb9ee3e2 838e7e2c .config log report info KASAN: use-after-free Read in ovs_ct_exit