]> git.ipfire.org Git - thirdparty/linux.git/commit
netfilter: ipset: rework cidr bookkeeping
authorJozsef Kadlecsik <kadlec@netfilter.org>
Thu, 30 Jul 2026 18:38:49 +0000 (20:38 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 31 Jul 2026 13:56:50 +0000 (15:56 +0200)
commit8e5fd2a55e2468f6225ef5af01ae58cdbcbae8cf
treeb477887f21d887f9f10c9538911632ad404e5ffe
parent30825970339c107bacaf7f61af90fcdb1f597ca1
netfilter: ipset: rework cidr bookkeeping

According to sashiko, the current bookkeeping of cidr values are unsafe
on weakly-ordered architectures. Replace the in-place updating with an
RCU based method: create the new bookeeping structure, update and replace
the old one with the new. Downside that we need to allocate memory when
deleting a cidr entry - in case of memory pressure fall back to leave holes
which possibility is taken into account at evaluation time.

Thanks to Pablo (Pablo Neira Ayuso <pablo@netfilter.org>) and Cyntia
(Cynthia <cynthia@kosmx.dev>) for helping me in debugging which resulted
the patch "netfilter: ipset: allocate the proper memory for the generic
hash structure" on which this very patch depends.

Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/ipset/ip_set_hash_gen.h
net/netfilter/ipset/ip_set_hash_ipportnet.c
net/netfilter/ipset/ip_set_hash_net.c
net/netfilter/ipset/ip_set_hash_netiface.c
net/netfilter/ipset/ip_set_hash_netnet.c
net/netfilter/ipset/ip_set_hash_netport.c
net/netfilter/ipset/ip_set_hash_netportnet.c