From: Simon Horman <horms@kernel.org>
To: Stanislav Fomichev <sdf@fomichev.me>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org, corbet@lwn.net, andrew+netdev@lunn.ch,
pablo@netfilter.org, kadlec@netfilter.org
Subject: Re: [PATCH net-next] net: revert to lockless TC_SETUP_BLOCK and TC_SETUP_FT
Date: Wed, 12 Mar 2025 13:43:40 +0100 [thread overview]
Message-ID: <20250312124340.GR4159220@kernel.org> (raw)
In-Reply-To: <20250308044726.1193222-1-sdf@fomichev.me>
On Fri, Mar 07, 2025 at 08:47:26PM -0800, Stanislav Fomichev wrote:
> There is a couple of places from which we can arrive to ndo_setup_tc
> with TC_SETUP_BLOCK/TC_SETUP_FT:
> - netlink
> - netlink notifier
> - netdev notifier
>
> Locking netdev too deep in this call chain seems to be problematic
> (especially assuming some/all of the call_netdevice_notifiers
> NETDEV_UNREGISTER) might soon be running with the instance lock).
> Revert to lockless ndo_setup_tc for TC_SETUP_BLOCK/TC_SETUP_FT. NFT
> framework already takes care of most of the locking. Document
> the assumptions.
>
> ndo_setup_tc TC_SETUP_BLOCK
> nft_block_offload_cmd
> nft_chain_offload_cmd
> nft_flow_block_chain
> nft_flow_offload_chain
> nft_flow_rule_offload_abort
> nft_flow_rule_offload_commit
> nft_flow_rule_offload_commit
> nf_tables_commit
> nfnetlink_rcv_batch
> nfnetlink_rcv_skb_batch
> nfnetlink_rcv
> nft_offload_netdev_event
> NETDEV_UNREGISTER notifier
>
> ndo_setup_tc TC_SETUP_FT
> nf_flow_table_offload_cmd
> nf_flow_table_offload_setup
> nft_unregister_flowtable_hook
> nft_register_flowtable_net_hooks
> nft_flowtable_update
> nf_tables_newflowtable
> nfnetlink_rcv_batch (.call NFNL_CB_BATCH)
> nft_flowtable_update
> nf_tables_newflowtable
> nft_flowtable_event
> nf_tables_flowtable_event
> NETDEV_UNREGISTER notifier
> __nft_unregister_flowtable_net_hooks
> nft_unregister_flowtable_net_hooks
> nf_tables_commit
> nfnetlink_rcv_batch (.call NFNL_CB_BATCH)
> __nf_tables_abort
> nf_tables_abort
> nfnetlink_rcv_batch
> __nft_release_hook
> __nft_release_hooks
> nf_tables_pre_exit_net -> module unload
> nft_rcv_nl_event
> netlink_register_notifier (oh boy)
> nft_register_flowtable_net_hooks
> nft_flowtable_update
> nf_tables_newflowtable
> nf_tables_newflowtable
>
> Fixes: c4f0f30b424e ("net: hold netdev instance lock during nft ndo_setup_tc")
> Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
Thanks Stan,
Thinking aloud: the dev_setup_tc() helper checked if ndo_setup_tc is
non-NULL, but that is not the case here. But that seems ok because it was
also the case prior to the cited commit.
Reviewed-by: Simon Horman <horms@kernel.org>
...
next prev parent reply other threads:[~2025-03-12 12:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-08 4:47 [PATCH net-next] net: revert to lockless TC_SETUP_BLOCK and TC_SETUP_FT Stanislav Fomichev
2025-03-08 6:41 ` Eric Dumazet
2025-03-08 17:08 ` Stanislav Fomichev
2025-03-12 12:43 ` Simon Horman [this message]
2025-03-12 20:20 ` patchwork-bot+netdevbpf
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=20250312124340.GR4159220@kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=sdf@fomichev.me \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.