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: 396d, last: 21d
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 778d 777d 0/24 auto-closed as invalid on 2020/12/08 16:36

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ovs_ct_limit_exit net/openvswitch/conntrack.c:1922 [inline]
BUG: KASAN: use-after-free in ovs_ct_exit+0x2df/0x4a0 net/openvswitch/conntrack.c:2316
Read of size 8 at addr ffff888035aae880 by task kworker/u4:4/91

CPU: 1 PID: 91 Comm: kworker/u4:4 Not tainted 6.0.0-rc3-syzkaller-00031-gc5e4d5e99162 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Workqueue: netns cleanup_net
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:317 [inline]
 print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
 kasan_report+0xb1/0x1e0 mm/kasan/report.c:495
 ovs_ct_limit_exit net/openvswitch/conntrack.c:1922 [inline]
 ovs_ct_exit+0x2df/0x4a0 net/openvswitch/conntrack.c:2316
 ovs_exit_net+0x19c/0xbc0 net/openvswitch/datapath.c:2612
 ops_exit_list+0xb0/0x170 net/core/net_namespace.c:163
 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:595
 process_one_work+0x991/0x1610 kernel/workqueue.c:2289
 worker_thread+0x665/0x1080 kernel/workqueue.c:2436
 kthread+0x2e4/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
 </TASK>

Allocated by task 9015:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:437 [inline]
 ____kasan_kmalloc mm/kasan/common.c:516 [inline]
 ____kasan_kmalloc mm/kasan/common.c:475 [inline]
 __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:525
 kmalloc include/linux/slab.h:600 [inline]
 ovs_ct_limit_set_zone_limit net/openvswitch/conntrack.c:1985 [inline]
 ovs_ct_limit_cmd_set+0x3dd/0xc70 net/openvswitch/conntrack.c:2161
 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731
 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
 genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:792
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:734
 ____sys_sendmsg+0x6eb/0x810 net/socket.c:2482
 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
 __sys_sendmsg+0xf3/0x1c0 net/socket.c:2565
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 3683:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track+0x21/0x30 mm/kasan/common.c:45
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
 ____kasan_slab_free mm/kasan/common.c:367 [inline]
 ____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:329
 kasan_slab_free include/linux/kasan.h:200 [inline]
 slab_free_hook mm/slub.c:1754 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780
 slab_free mm/slub.c:3534 [inline]
 kmem_cache_free_bulk.part.0+0x205/0x880 mm/slub.c:3660
 kfree_bulk include/linux/slab.h:456 [inline]
 kfree_rcu_work+0x56c/0xa60 kernel/rcu/tree.c:3035
 process_one_work+0x991/0x1610 kernel/workqueue.c:2289
 worker_thread+0x665/0x1080 kernel/workqueue.c:2436
 kthread+0x2e4/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Last potentially related work creation:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348
 kvfree_call_rcu+0x74/0x940 kernel/rcu/tree.c:3322
 ovs_ct_limit_exit net/openvswitch/conntrack.c:1924 [inline]
 ovs_ct_exit+0x21e/0x4a0 net/openvswitch/conntrack.c:2316
 ovs_exit_net+0x19c/0xbc0 net/openvswitch/datapath.c:2612
 ops_exit_list+0xb0/0x170 net/core/net_namespace.c:163
 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:595
 process_one_work+0x991/0x1610 kernel/workqueue.c:2289
 worker_thread+0x665/0x1080 kernel/workqueue.c:2436
 kthread+0x2e4/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

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

The buggy address belongs to the physical page:
page:ffffea0000d6ab80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x35aae
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea000083b500 dead000000000005 ffff888011841640
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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 9015, tgid 9013 (syz-executor.5), ts 509923681742, free_ts 509905985663
 prep_new_page mm/page_alloc.c:2532 [inline]
 get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283
 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5515
 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2270
 alloc_slab_page mm/slub.c:1824 [inline]
 allocate_slab+0x27e/0x3d0 mm/slub.c:1969
 new_slab mm/slub.c:2029 [inline]
 ___slab_alloc+0x7f1/0xe10 mm/slub.c:3031
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118
 slab_alloc_node mm/slub.c:3209 [inline]
 slab_alloc mm/slub.c:3251 [inline]
 kmem_cache_alloc_trace+0x323/0x3e0 mm/slub.c:3282
 kmalloc include/linux/slab.h:600 [inline]
 ovs_ct_limit_set_zone_limit net/openvswitch/conntrack.c:1985 [inline]
 ovs_ct_limit_cmd_set+0x3dd/0xc70 net/openvswitch/conntrack.c:2161
 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731
 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
 genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:792
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2501
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:734
 ____sys_sendmsg+0x6eb/0x810 net/socket.c:2482
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1449 [inline]
 free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499
 free_unref_page_prepare mm/page_alloc.c:3380 [inline]
 free_unref_page_list+0x16f/0xb90 mm/page_alloc.c:3522
 release_pages+0xbd3/0x1400 mm/swap.c:1012
 tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:58
 tlb_flush_mmu_free mm/mmu_gather.c:255 [inline]
 tlb_flush_mmu mm/mmu_gather.c:262 [inline]
 tlb_finish_mmu+0x147/0x7e0 mm/mmu_gather.c:353
 exit_mmap+0x1d2/0x490 mm/mmap.c:3118
 __mmput+0x122/0x4b0 kernel/fork.c:1187
 mmput+0x56/0x60 kernel/fork.c:1208
 exit_mm kernel/exit.c:510 [inline]
 do_exit+0x9e2/0x29b0 kernel/exit.c:782
 do_group_exit+0xd2/0x2f0 kernel/exit.c:925
 get_signal+0x238c/0x2610 kernel/signal.c:2857
 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869
 exit_to_user_mode_loop kernel/entry/common.c:166 [inline]
 exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201
 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
 syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff888035aae780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888035aae800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888035aae880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff888035aae900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888035aae980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (21):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2022/09/01 12:44 upstream c5e4d5e99162 b01ec571 .config log report info KASAN: use-after-free Read in ovs_ct_exit
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/09/07 07:06 bpf 8a7d61bdc2fa 5fc30c37 .config log report info KASAN: use-after-free Read in ovs_ct_exit
ci-upstream-bpf-kasan-gce 2022/08/19 20:47 bpf 7d6620f107ba 26a13b38 .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 2022/05/31 18:20 bpf-next 4b4b4f94a4f6 af70c3a9 .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
* Struck through repros no longer work on HEAD.