Skip to content

netfilter: nft_set_pipapo: move clone allocation to insert/removal path

Natarajan KV stable 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 2 repliesIn review
  2. v21 patch 1 replySuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8netfilter: nft_set_pipapo: move prove_locking helper aroundnet/netfilter/nft_set_pipapo.c+11 -111 reply
2/8netfilter: nft_set_pipapo: make pipapo_clone helper return NULLnet/netfilter/nft_set_pipapo.c+7 -70 replies
3/8netfilter: nft_set_pipapo: prepare destroy function for on-demand clonenet/netfilter/nft_set_pipapo.c+6 -210 replies
4/8netfilter: nft_set_pipapo: prepare walk function for on-demand clonenet/netfilter/nft_set_pipapo.c+39 -210 replies
5/8netfilter: nft_set_pipapo: merge deactivate helper into callernet/netfilter/nft_set_pipapo.c+2 -20 replies
6/8netfilter: nft_set_pipapo: prepare pipapo_get helper for on-demand clonenet/netfilter/nft_set_pipapo.c+12 -120 replies
7/8netfilter: nft_set_pipapo: move cloning of match info to insert/removal pathnet/netfilter/nft_set_pipapo.c+46 -430 replies
8/8netfilter: nft_set_pipapo: remove dirty flagnet/netfilter/nft_set_pipapo.c net/netfilter/nft_set_pipapo.h+2 -20 replies

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by.

PatchStefano Brivio
1/8R-b
2/8R-b
3/8R-b
4/8R-b
5/8R-b
6/8R-b
7/8R-b
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 6.6.y 0/8] netfilter: nft_set_pipapo: move clone allocation to insert/removal path

This is a backport of the following mainline series to 6.6.122:

a590f4760922 ("netfilter: nft_set_pipapo: move prove_locking helper around") 80efd2997fb9 ("netfilter: nft_set_pipapo: make pipapo_clone helper return NULL") 8b8a2417558c ("netfilter: nft_set_pipapo: prepare destroy function for on-demand clone") 6c108d9bee44 ("netfilter: nft_set_pipapo: prepare walk function for on-demand clone") c5444786d0ea ("netfilter: nft_set_pipapo: merge deactivate helper into caller") a238106703ab ("netfilter: nft_set_pipapo: prepare pipapo_get helper for on-demand clone") 3f1d886cc7c3 ("netfilter: nft_set_pipapo: move cloning of match info to insert/removal path") 532aec7e878b ("netfilter: nft_set_pipapo: remove dirty flag")

The pipapo set backend currently calls pipapo_clone() from the commit and abort callbacks. These callbacks must not fail, but pipapo_clone() can fail with ENOMEM. When this happens, the working copy ends up in a corrupt state: freed elements remain accessible, and the dirty flag stays set, causing the next commit to promote a stale clone.

This series moves pipapo_clone() to the insert and removal paths via a new pipapo_maybe_clone() helper that creates the working copy on demand and can propagate -ENOMEM to the caller.

Patches 1-4 cherry-pick cleanly from mainline. Patches 5-8 are adapted for 6.6.122's different API:
- nft_pipapo_flush() still uses the pipapo_deactivate() helper (mainline removed it via the elem_priv refactor)
- pipapo_get() has no GFP parameter (always GFP_ATOMIC)
- nft_pipapo_commit() is non-const in 6.6.x

Build-tested with both nft_set_pipapo.o and nft_set_pipapo_avx2.o.

Florian Westphal (8):
netfilter: nft_set_pipapo: move prove_locking helper around
netfilter: nft_set_pipapo: make pipapo_clone helper return NULL
netfilter: nft_set_pipapo: prepare destroy function for on-demand clone
netfilter: nft_set_pipapo: prepare walk function for on-demand clone
netfilter: nft_set_pipapo: merge deactivate helper into caller
netfilter: nft_set_pipapo: prepare pipapo_get helper for on-demand clone
netfilter: nft_set_pipapo: move cloning of match info to insert/removal path
netfilter: nft_set_pipapo: remove dirty flag

 net/netfilter/nft_set_pipapo.c | 196 +++++++++++++++++---------------
 net/netfilter/nft_set_pipapo.h |   6 --
 2 files changed, 107 insertions(+), 95 deletions(-)
Signature · 1 line
2.39.5