* [PATCH nft] evaluate: init cmd pointer for new on-stack context
@ 2022-03-04 10:36 Florian Westphal
2022-03-04 10:54 ` Pablo Neira Ayuso
0 siblings, 1 reply; 4+ messages in thread
From: Florian Westphal @ 2022-03-04 10:36 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
else, this will segfault when trying to print the
"table 'x' doesn't exist" error message.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/evaluate.c | 1 +
tests/shell/testcases/chains/0041chain_binding_0 | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/src/evaluate.c b/src/evaluate.c
index 2732f5f49e06..07a4b0ad19b0 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -3425,6 +3425,7 @@ static int stmt_evaluate_chain(struct eval_ctx *ctx, struct stmt *stmt)
struct eval_ctx rule_ctx = {
.nft = ctx->nft,
.msgs = ctx->msgs,
+ .cmd = ctx->cmd,
};
struct handle h2 = {};
diff --git a/tests/shell/testcases/chains/0041chain_binding_0 b/tests/shell/testcases/chains/0041chain_binding_0
index 59bdbe9f0ba9..806c17535002 100755
--- a/tests/shell/testcases/chains/0041chain_binding_0
+++ b/tests/shell/testcases/chains/0041chain_binding_0
@@ -1,5 +1,11 @@
#!/bin/bash
+# no table z, caused segfault in earlier nft releases
+$NFT insert rule inet x y handle 107 'goto { log prefix "MOO! "; }'
+if [ $? -ne 1 ]; then
+ exit 1
+fi
+
set -e
EXPECTED="table inet x {
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH nft] evaluate: init cmd pointer for new on-stack context
2022-03-04 10:36 [PATCH nft] evaluate: init cmd pointer for new on-stack context Florian Westphal
@ 2022-03-04 10:54 ` Pablo Neira Ayuso
2022-03-04 11:15 ` Florian Westphal
2022-03-04 13:41 ` Phil Sutter
0 siblings, 2 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2022-03-04 10:54 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Fri, Mar 04, 2022 at 11:36:34AM +0100, Florian Westphal wrote:
> else, this will segfault when trying to print the
> "table 'x' doesn't exist" error message.
LGTM, thanks. One nitpick below:
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> src/evaluate.c | 1 +
> tests/shell/testcases/chains/0041chain_binding_0 | 6 ++++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/src/evaluate.c b/src/evaluate.c
> index 2732f5f49e06..07a4b0ad19b0 100644
> --- a/src/evaluate.c
> +++ b/src/evaluate.c
> @@ -3425,6 +3425,7 @@ static int stmt_evaluate_chain(struct eval_ctx *ctx, struct stmt *stmt)
> struct eval_ctx rule_ctx = {
> .nft = ctx->nft,
> .msgs = ctx->msgs,
> + .cmd = ctx->cmd,
> };
> struct handle h2 = {};
>
> diff --git a/tests/shell/testcases/chains/0041chain_binding_0 b/tests/shell/testcases/chains/0041chain_binding_0
> index 59bdbe9f0ba9..806c17535002 100755
> --- a/tests/shell/testcases/chains/0041chain_binding_0
> +++ b/tests/shell/testcases/chains/0041chain_binding_0
> @@ -1,5 +1,11 @@
> #!/bin/bash
>
> +# no table z, caused segfault in earlier nft releases
this is no table x?
> +$NFT insert rule inet x y handle 107 'goto { log prefix "MOO! "; }'
> +if [ $? -ne 1 ]; then
> + exit 1
> +fi
> +
> set -e
>
> EXPECTED="table inet x {
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH nft] evaluate: init cmd pointer for new on-stack context
2022-03-04 10:54 ` Pablo Neira Ayuso
@ 2022-03-04 11:15 ` Florian Westphal
2022-03-04 13:41 ` Phil Sutter
1 sibling, 0 replies; 4+ messages in thread
From: Florian Westphal @ 2022-03-04 11:15 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: Florian Westphal, netfilter-devel
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Fri, Mar 04, 2022 at 11:36:34AM +0100, Florian Westphal wrote:
> > else, this will segfault when trying to print the
> > "table 'x' doesn't exist" error message.
>
> LGTM, thanks. One nitpick below:
I've pushed it out with the corrected comment.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH nft] evaluate: init cmd pointer for new on-stack context
2022-03-04 10:54 ` Pablo Neira Ayuso
2022-03-04 11:15 ` Florian Westphal
@ 2022-03-04 13:41 ` Phil Sutter
1 sibling, 0 replies; 4+ messages in thread
From: Phil Sutter @ 2022-03-04 13:41 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: Florian Westphal, netfilter-devel
On Fri, Mar 04, 2022 at 11:54:39AM +0100, Pablo Neira Ayuso wrote:
> On Fri, Mar 04, 2022 at 11:36:34AM +0100, Florian Westphal wrote:
> > else, this will segfault when trying to print the
> > "table 'x' doesn't exist" error message.
>
> LGTM, thanks. One nitpick below:
This also fixes the segfault I was trying to avoid with my patch for
string_misspell_update(). I had definitely tried Florian's solution, but
it didn't work for me. Guess there's a bug in my test env or something.
:(
Thanks, Phil
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-04 13:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 10:36 [PATCH nft] evaluate: init cmd pointer for new on-stack context Florian Westphal
2022-03-04 10:54 ` Pablo Neira Ayuso
2022-03-04 11:15 ` Florian Westphal
2022-03-04 13:41 ` Phil Sutter
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.