All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: nf_tables: remove redundant chain validation on register store
@ 2025-11-19 12:42 Pablo Neira Ayuso
  2025-11-19 12:45 ` Florian Westphal
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2025-11-19 12:42 UTC (permalink / raw)
  To: netfilter-devel; +Cc: fw

This validation predates the introduction of the state machine that
determines when to enter slow path validation for error reporting.

Currently, table validation is perform when:

- new rule contains expressions that need validation.
- new set element with jump/goto verdict.

Validation on register store skips most checks with no basechains, still
this walks the graph searching for loops and ensuring expressions are
called from the right hook. Remove this.

Fixes: a654de8fdc18 ("netfilter: nf_tables: fix chain dependency validation")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
Supersedes: ("netfilter: nf_tables: skip register jump/goto validation for non-base chain")

No rush to apply this, still running a few more tests here on it.

 net/netfilter/nf_tables_api.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index f3de2f9bbebf..c46b1bb0efe0 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -11676,21 +11676,10 @@ static int nft_validate_register_store(const struct nft_ctx *ctx,
 				       enum nft_data_types type,
 				       unsigned int len)
 {
-	int err;
-
 	switch (reg) {
 	case NFT_REG_VERDICT:
 		if (type != NFT_DATA_VERDICT)
 			return -EINVAL;
-
-		if (data != NULL &&
-		    (data->verdict.code == NFT_GOTO ||
-		     data->verdict.code == NFT_JUMP)) {
-			err = nft_chain_validate(ctx, data->verdict.chain);
-			if (err < 0)
-				return err;
-		}
-
 		break;
 	default:
 		if (type != NFT_DATA_VALUE)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf-next] netfilter: nf_tables: remove redundant chain validation on register store
  2025-11-19 12:42 [PATCH nf-next] netfilter: nf_tables: remove redundant chain validation on register store Pablo Neira Ayuso
@ 2025-11-19 12:45 ` Florian Westphal
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2025-11-19 12:45 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> This validation predates the introduction of the state machine that
> determines when to enter slow path validation for error reporting.
> 
> Currently, table validation is perform when:
> 
> - new rule contains expressions that need validation.
> - new set element with jump/goto verdict.
> 
> Validation on register store skips most checks with no basechains, still
> this walks the graph searching for loops and ensuring expressions are
> called from the right hook. Remove this.
> 
> Fixes: a654de8fdc18 ("netfilter: nf_tables: fix chain dependency validation")
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> Supersedes: ("netfilter: nf_tables: skip register jump/goto validation for non-base chain")
> 
> No rush to apply this, still running a few more tests here on it.

Thanks!  I wonder if this impacts error location reporting.

I agree its not needed from correctness p.o.v. since commit (or abort)
validates entire completed ruleset.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-19 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 12:42 [PATCH nf-next] netfilter: nf_tables: remove redundant chain validation on register store Pablo Neira Ayuso
2025-11-19 12:45 ` Florian Westphal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.