From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next v3 0/5] netfilter: nf_tables: reduce set element transaction size
Date: Wed, 16 Oct 2024 16:36:19 +0200 [thread overview]
Message-ID: <Zw_PY7MXqNDOWE71@calendula> (raw)
In-Reply-To: <20241016131917.17193-1-fw@strlen.de>
On Wed, Oct 16, 2024 at 03:19:07PM +0200, Florian Westphal wrote:
> v3:
> I failed to realize that nft_audit leaks one implementation detail
> to userspace: the length of the transaction log.
>
> This is bad, but I do not know if we can change things to make
> nft_audit NOT do that. Hence add a new workaround patch that
> inflates the length based on the number of set elements in the
> container structure.
It actually shows the number of entries that have been updated, right?
Before this series, there was a 1:1 mapping between transaction and
objects so it was easier to infer it from the number of transaction
objects.
> Also fix up notifications, for update case, notifications were
> skipped but currently newsetelem notifications are done even if
> existing set element is updated.
>
> Most patches are unchanged.
> "prefer nft_trans_elem_alloc helper" is already upstreamed so
> its dropped from this batch.
>
>
> v2: only change is in patch 3, and by extension, the last one:
> During transaction abort, we need to handle an aggregate container to
> contain both new set elements and updates. The latter must be
> skipped, else we remove element that already existed at start of the
> transaction.
>
> original cover letter:
>
> When doing a flush on a set or mass adding/removing elements from a
> set, each element needs to allocate 96 bytes to hold the transactional
> state.
>
> In such cases, virtually all the information in struct nft_trans_elem
> is the same.
>
> Change nft_trans_elem to a flex-array, i.e. a single nft_trans_elem
> can hold multiple set element pointers.
>
> The number of elements that can be stored in one nft_trans_elem is limited
> by the slab allocator, this series limits the compaction to at most 62
> elements as it caps the reallocation to 2048 bytes of memory.
>
>
>
> Florian Westphal (5):
> netfilter: nf_tables: add nft_trans_commit_list_add_elem helper
> netfilter: nf_tables: prepare for multiple elements in nft_trans_elem
> structure
> netfiler: nf_tables: preemitve fix for audit failure
> netfilter: nf_tables: switch trans_elem to real flex array
> netfilter: nf_tables: allocate element update information dynamically
>
> include/net/netfilter/nf_tables.h | 25 +-
> net/netfilter/nf_tables_api.c | 368 +++++++++++++++++++++++-------
> 2 files changed, 304 insertions(+), 89 deletions(-)
>
> --
> 2.45.2
>
>
next prev parent reply other threads:[~2024-10-16 14:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 13:19 [PATCH nf-next v3 0/5] netfilter: nf_tables: reduce set element transaction size Florian Westphal
2024-10-16 13:19 ` [PATCH nf-next v3 1/5] netfilter: nf_tables: add nft_trans_commit_list_add_elem helper Florian Westphal
2024-10-16 13:19 ` [PATCH nf-next v3 2/5] netfilter: nf_tables: prepare for multiple elements in nft_trans_elem structure Florian Westphal
2024-10-16 13:19 ` [PATCH nf-next v3 3/5] netfiler: nf_tables: preemitve fix for audit failure Florian Westphal
2024-10-16 13:19 ` [PATCH nf-next v3 4/5] netfilter: nf_tables: switch trans_elem to real flex array Florian Westphal
2024-10-16 13:19 ` [PATCH nf-next v3 5/5] netfilter: nf_tables: allocate element update information dynamically Florian Westphal
2024-10-16 14:36 ` Pablo Neira Ayuso [this message]
2024-10-16 16:10 ` [PATCH nf-next v3 0/5] netfilter: nf_tables: reduce set element transaction size Florian Westphal
2024-10-17 16:23 ` Pablo Neira Ayuso
2024-10-17 19:33 ` Paul Moore
2024-10-17 22:53 ` Pablo Neira Ayuso
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=Zw_PY7MXqNDOWE71@calendula \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.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).