Helper for the actual bugfix. Signed-off-by: Gabriel Goller <[email protected]> --- ...les-make-nft_set_do_lookup-available.patch | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 patches/kernel/0017-netfilter-nf_tables-make-nft_set_do_lookup-available.patch
diff --git a/patches/kernel/0017-netfilter-nf_tables-make-nft_set_do_lookup-available.patch b/patches/kernel/0017-netfilter-nf_tables-make-nft_set_do_lookup-available.patch new file mode 100644 index 000000000000..0194b7e7776f --- /dev/null +++ b/patches/kernel/0017-netfilter-nf_tables-make-nft_set_do_lookup-available.patch @@ -0,0 +1,86 @@ +From 35120b5cb4467a234f4ffecc52c7ff6630a31907 Mon Sep 17 00:00:00 2001 +From: Gabriel Goller <[email protected]> +Date: Wed, 10 Sep 2025 12:10:11 +0200 +Subject: [PATCH 4/5] netfilter: nf_tables: make nft_set_do_lookup available + unconditionally + +This function was added for retpoline mitigation and is replaced by a +static inline helper if mitigations are not enabled. + +Enable this helper function unconditionally so next patch can add a lookup +restart mechanism to fix possible false negatives while transactions are +in progress. + +Adding lookup restarts in nft_lookup_eval doesn't work as nft_objref would +then need the same copypaste loop. + +This patch is separate to ease review of the actual bug fix. + +Suggested-by: Pablo Neira Ayuso <[email protected]> +Signed-off-by: Florian Westphal <[email protected]> +Signed-off-by: Gabriel Goller <[email protected]> +--- + include/net/netfilter/nf_tables_core.h | 10 ++-------- + net/netfilter/nft_lookup.c | 11 ++++++++--- + 2 files changed, 10 insertions(+), 11 deletions(-) + +diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h +index 03b6165756fc..04fc4a411a86 100644 +--- a/include/net/netfilter/nf_tables_core.h ++++ b/include/net/netfilter/nf_tables_core.h +@@ -105,16 +105,10 @@ bool nft_hash_lookup_fast(const struct net *net, + const u32 *key, const struct nft_set_ext **ext); + bool nft_hash_lookup(const struct net *net, const struct nft_set *set, + const u32 *key, const struct nft_set_ext **ext); ++#endif ++ + bool nft_set_do_lookup(const struct net *net, const struct nft_set *set, + const u32 *key, const struct nft_set_ext **ext); +-#else +-static inline bool +-nft_set_do_lookup(const struct net *net, const struct nft_set *set, +- const u32 *key, const struct nft_set_ext **ext) +-{ +- return set->ops->lookup(net, set, key, ext); +-} +-#endif + + /* called from nft_pipapo_avx2.c */ + bool nft_pipapo_lookup(const struct net *net, const struct nft_set *set, +diff --git a/net/netfilter/nft_lookup.c b/net/netfilter/nft_lookup.c +index 63ef832b8aa7..7d0add1041bb 100644 +--- a/net/netfilter/nft_lookup.c ++++ b/net/netfilter/nft_lookup.c +@@ -24,10 +24,10 @@ struct nft_lookup { + struct nft_set_binding binding; + }; + +-#ifdef CONFIG_MITIGATION_RETPOLINE +-bool nft_set_do_lookup(const struct net *net, const struct nft_set *set, ++static bool __nft_set_do_lookup(const struct net *net, const struct nft_set *set, + const u32 *key, const struct nft_set_ext **ext) + { ++#ifdef CONFIG_MITIGATION_RETPOLINE + if (set->ops == &nft_set_hash_fast_type.ops) + return nft_hash_lookup_fast(net, set, key, ext); + if (set->ops == &nft_set_hash_type.ops) +@@ -50,10 +50,15 @@ bool nft_set_do_lookup(const struct net *net, const struct nft_set *set, + return nft_rbtree_lookup(net, set, key, ext); + + WARN_ON_ONCE(1); ++#endif + return set->ops->lookup(net, set, key, ext); + } ++bool nft_set_do_lookup(const struct net *net, const struct nft_set *set, ++ const u32 *key, const struct nft_set_ext **ext) ++{ ++ return __nft_set_do_lookup(net, set, key, ext); ++} + EXPORT_SYMBOL_GPL(nft_set_do_lookup); +-#endif + + void nft_lookup_eval(const struct nft_expr *expr, + struct nft_regs *regs, +-- +2.47.3 + -- 2.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
