From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>,
netfilter-devel@vger.kernel.org, Eric Garver <e@erig.me>
Subject: Re: [nf-next PATCH v6 0/7] Dynamic hook interface binding part 1
Date: Thu, 21 Nov 2024 18:04:55 +0100 [thread overview]
Message-ID: <Zz9oN_OBdCQ1wlQf@orbyte.nwl.cc> (raw)
In-Reply-To: <Zzy4LTNe4a4bepmX@orbyte.nwl.cc>
Hi,
On Tue, Nov 19, 2024 at 05:09:17PM +0100, Phil Sutter wrote:
[...]
> Checking callers of nft_unregister_flowtable_net_hooks():
>
> nf_tables_commit() calls it for DELFLOWTABLE, code-paths differ for
> flowtable updates or complete deletions: With the latter,
> nft_commit_release() calls nf_tables_flowtable_destroy() which does the
> UNBIND. So if deleting individual interfaces from an offloaded flowtable
> is supported, we may miss the UNBIND there.
>
> __nf_tables_abort() calls it for NEWFLOWTABLE. The hooks should have
> been bound by nf_tables_newflowtable() (or nft_flowtable_update(),
> respectively) so this seems like missing UNBIND there.
>
> Now about __nft_release_hook, I see:
>
> nf_tables_pre_exit_net
> -> __nft_release_hooks
> -> __nft_release_hook
>
> Do we have to UNBIND at netns exit?
>
> There is also:
>
> nft_rcv_nl_event
> -> __nft_release_hook
>
> I don't see where hooks of flowtables in owner flag tables are unbound.
So I validated these findings by adding printks to BIND and UNBIND calls
and performing these actions:
- Delete an interface from a flowtable with multiple interfaces
- Add a (device to a) flowtable with --check flag
- Delete a netns containing a flowtable
- In an interactive nft session, create a table with owner flag and
flowtable inside, then quit
All these cases cause imbalance between BIND and UNBIND calls. Looking
at possible fixes, I wonder how things are supposed to be: When deleting
a flowtable, nf_tables_commit will unregister hooks (via
nf_unregister_net_hook), but not unlink/free them. Then, in
nft_commit_release, the UNBIND happens along with unlink/free. Is this
the correct process? Namely unregister and wait for RCU grace period
before performing UNBIND? Or is this arbitrary and combining unregister
with UBIND is OK in all cases?
Cheers, Phil
next prev parent reply other threads:[~2024-11-21 17:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 14:57 [nf-next PATCH v6 0/7] Dynamic hook interface binding part 1 Phil Sutter
2024-10-23 14:57 ` [nf-next PATCH v6 1/7] netfilter: nf_tables: Flowtable hook's pf value never varies Phil Sutter
2024-10-23 14:57 ` [nf-next PATCH v6 2/7] netfilter: nf_tables: Store user-defined hook ifname Phil Sutter
2024-10-23 14:57 ` [nf-next PATCH v6 3/7] netfilter: nf_tables: Use stored ifname in netdev hook dumps Phil Sutter
2024-10-23 14:57 ` [nf-next PATCH v6 4/7] netfilter: nf_tables: Compare netdev hooks based on stored name Phil Sutter
2024-10-23 14:57 ` [nf-next PATCH v6 5/7] netfilter: nf_tables: Tolerate chains with no remaining hooks Phil Sutter
2024-10-23 14:57 ` [nf-next PATCH v6 6/7] netfilter: nf_tables: Simplify chain netdev notifier Phil Sutter
2024-10-23 14:57 ` [nf-next PATCH v6 7/7] netfilter: nf_tables: Drop __nft_unregister_flowtable_net_hooks() Phil Sutter
2024-11-15 11:57 ` [nf-next PATCH v6 0/7] Dynamic hook interface binding part 1 Pablo Neira Ayuso
2024-11-19 16:09 ` Phil Sutter
2024-11-21 17:04 ` Phil Sutter [this message]
2024-11-22 13:39 ` Pablo Neira Ayuso
2024-11-22 18:18 ` Phil Sutter
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=Zz9oN_OBdCQ1wlQf@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=e@erig.me \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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