Skip to contentSkip to conversation

netfilter: nf_tables: disable expression reduction infra

PATCH New Pablo Neira Ayuso 1 participant 1 message May 18, 2022

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nf_tables: disable expression reduction infra

Either userspace or kernelspace need to pre-fetch keys inconditionally before comparisons for this to work. Otherwise, register tracking data is misleading and it might result in reducing expressions which are not yet registers.

First expression is also guaranteed to be evaluated always, therefore, since some expression, eg. nft_meta for certain keys to break before comparison. Other expressions such as nft_socket rely on packet evaluation for the socket object, otherwise break before the comparison, in this case tracking should be canceled.

This patch disables this infrastructure by now.

Fixes b2d306542ff9 ("netfilter: nf_tables: do not reduce read-only expressions")
---
 net/netfilter/nf_tables_api.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
net/netfilter/nf_tables_api.c +1 -10
index 16c3a39689f4..a096b9fbbbdf 100644
@@ -8342,16 +8342,7 @@ EXPORT_SYMBOL_GPL(nf_tables_trans_destroy_flush_work);
 static bool nft_expr_reduce(struct nft_regs_track *track,
 			    const struct nft_expr *expr)
 {
-	if (!expr->ops->reduce) {
-		pr_warn_once("missing reduce for expression %s ",
-			     expr->ops->type->name);
-		return false;
-	}
-
-	if (nft_reduce_is_readonly(expr))
-		return false;
-
-	return expr->ops->reduce(track, expr);
+	return false;
 }
 
 static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *chain)
Signature · 1 line
2.30.2