From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 40B381FF165 for ; Thu, 11 Sep 2025 12:06:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 54125FE18; Thu, 11 Sep 2025 12:06:04 +0200 (CEST) From: Gabriel Goller To: pve-devel@lists.proxmox.com Date: Thu, 11 Sep 2025 12:05:45 +0200 Message-ID: <20250911100555.63174-5-g.goller@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250911100555.63174-1-g.goller@proxmox.com> References: <20250911100555.63174-1-g.goller@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757585157349 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve-kernel 4/5] kernel: backport: netfilter: nf_tables: make nft_set_do_lookup available unconditionally X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Helper for the actual bugfix. Signed-off-by: Gabriel Goller --- ...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 +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 +Signed-off-by: Florian Westphal +Signed-off-by: Gabriel Goller +--- + 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 pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel