From: Aaron Conole <aconole@redhat.com>
To: Eelco Chaudron <echaudro@redhat.com>
Cc: netdev@vger.kernel.org, pshelar@ovn.org, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
dev@openvswitch.org
Subject: Re: [PATCH net] net: openvswitch: fix upcall counter access before allocation
Date: Tue, 06 Jun 2023 16:51:50 -0400 [thread overview]
Message-ID: <f7tfs745n6h.fsf@redhat.com> (raw)
In-Reply-To: <168595558535.1618839.4634246126873842766.stgit@ebuild> (Eelco Chaudron's message of "Mon, 5 Jun 2023 10:59:50 +0200")
Eelco Chaudron <echaudro@redhat.com> writes:
> Currently, the per cpu upcall counters are allocated after the vport is
> created and inserted into the system. This could lead to the datapath
> accessing the counters before they are allocated resulting in a kernel
> Oops.
>
> Here is an example:
>
> PID: 59693 TASK: ffff0005f4f51500 CPU: 0 COMMAND: "ovs-vswitchd"
> #0 [ffff80000a39b5b0] __switch_to at ffffb70f0629f2f4
> #1 [ffff80000a39b5d0] __schedule at ffffb70f0629f5cc
> #2 [ffff80000a39b650] preempt_schedule_common at ffffb70f0629fa60
> #3 [ffff80000a39b670] dynamic_might_resched at ffffb70f0629fb58
> #4 [ffff80000a39b680] mutex_lock_killable at ffffb70f062a1388
> #5 [ffff80000a39b6a0] pcpu_alloc at ffffb70f0594460c
> #6 [ffff80000a39b750] __alloc_percpu_gfp at ffffb70f05944e68
> #7 [ffff80000a39b760] ovs_vport_cmd_new at ffffb70ee6961b90 [openvswitch]
> ...
>
> PID: 58682 TASK: ffff0005b2f0bf00 CPU: 0 COMMAND: "kworker/0:3"
> #0 [ffff80000a5d2f40] machine_kexec at ffffb70f056a0758
> #1 [ffff80000a5d2f70] __crash_kexec at ffffb70f057e2994
> #2 [ffff80000a5d3100] crash_kexec at ffffb70f057e2ad8
> #3 [ffff80000a5d3120] die at ffffb70f0628234c
> #4 [ffff80000a5d31e0] die_kernel_fault at ffffb70f062828a8
> #5 [ffff80000a5d3210] __do_kernel_fault at ffffb70f056a31f4
> #6 [ffff80000a5d3240] do_bad_area at ffffb70f056a32a4
> #7 [ffff80000a5d3260] do_translation_fault at ffffb70f062a9710
> #8 [ffff80000a5d3270] do_mem_abort at ffffb70f056a2f74
> #9 [ffff80000a5d32a0] el1_abort at ffffb70f06297dac
> #10 [ffff80000a5d32d0] el1h_64_sync_handler at ffffb70f06299b24
> #11 [ffff80000a5d3410] el1h_64_sync at ffffb70f056812dc
> #12 [ffff80000a5d3430] ovs_dp_upcall at ffffb70ee6963c84 [openvswitch]
> #13 [ffff80000a5d3470] ovs_dp_process_packet at ffffb70ee6963fdc [openvswitch]
> #14 [ffff80000a5d34f0] ovs_vport_receive at ffffb70ee6972c78 [openvswitch]
> #15 [ffff80000a5d36f0] netdev_port_receive at ffffb70ee6973948 [openvswitch]
> #16 [ffff80000a5d3720] netdev_frame_hook at ffffb70ee6973a28 [openvswitch]
> #17 [ffff80000a5d3730] __netif_receive_skb_core.constprop.0 at ffffb70f06079f90
>
> We moved the per cpu upcall counter allocation to the existing vport
> alloc and free functions to solve this.
>
> Fixes: 95637d91fefd ("net: openvswitch: release vport resources on failure")
> Fixes: 1933ea365aa7 ("net: openvswitch: Add support to count upcall packets")
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
Acked-by: Aaron Conole <aconole@redhat.com>
This is a particularly difficult one to reproduce. Thanks for posting
the fix.
prev parent reply other threads:[~2023-06-06 20:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 8:59 [PATCH net] net: openvswitch: fix upcall counter access before allocation Eelco Chaudron
2023-06-05 12:41 ` [ovs-dev] " Simon Horman
2023-06-05 12:54 ` Eelco Chaudron
2023-06-05 13:07 ` Simon Horman
2023-06-05 13:53 ` Eelco Chaudron
2023-06-05 14:38 ` Simon Horman
2023-06-06 11:43 ` Paolo Abeni
2023-06-06 11:57 ` Eelco Chaudron
2023-06-06 20:51 ` Aaron Conole [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7tfs745n6h.fsf@redhat.com \
--to=aconole@redhat.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=echaudro@redhat.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pshelar@ovn.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).