Skip to contentSkip to conversation

netlink: meta: fix wrong type in attributes

PATCH In review Florian Westphal 3 participants 8 messages Feb 17, 2014 – Feb 18, 2014 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 netlink: meta: fix wrong type in attributes

We segfault on 'list filter' when meta expr is used as _u8 returns invalid register 0.

---
 src/netlink_delinearize.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/netlink_delinearize.c +2 -2
index 6668308..b976d86 100644
@@ -346,9 +346,9 @@ static void netlink_parse_meta_sreg(struct netlink_parse_ctx *ctx,
 	struct expr *expr;
 
 	expr = netlink_get_register(ctx, loc,
-			nft_rule_expr_get_u8(nle, NFT_EXPR_META_SREG));
+			nft_rule_expr_get_u32(nle, NFT_EXPR_META_SREG));
 	stmt = meta_stmt_alloc(loc,
-			       nft_rule_expr_get_u8(nle, NFT_EXPR_META_KEY),
+			       nft_rule_expr_get_u32(nle, NFT_EXPR_META_KEY),
 			       expr);
 	expr_set_type(expr, stmt->meta.tmpl->dtype, stmt->meta.tmpl->byteorder);
 
Signature · 1 line
1.8.1.5
#1 lore raw
Quoted 2 lines · Florian Westphal

We segfault on 'list filter' when meta expr is used as _u8 returns invalid register 0.

This seems to only affect the master branch. Not sure how many people are using that and if its worth doing a new release. I'd rather merge the next-3.14 branch and have people use that.

On a side note: there's no reason to have our releases timed after kernel releases. At this point I'd rather go for more frequent releases of the current code instead of backporting fixes.

Quoted 28 lines
---
 src/netlink_delinearize.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/netlink_delinearize.c +2 -2
index 6668308..b976d86 100644
@@ -346,9 +346,9 @@ static void netlink_parse_meta_sreg(struct netlink_parse_ctx *ctx,
 	struct expr *expr;
 
 	expr = netlink_get_register(ctx, loc,
-			nft_rule_expr_get_u8(nle, NFT_EXPR_META_SREG));
+			nft_rule_expr_get_u32(nle, NFT_EXPR_META_SREG));
 	stmt = meta_stmt_alloc(loc,
-			       nft_rule_expr_get_u8(nle, NFT_EXPR_META_KEY),
+			       nft_rule_expr_get_u32(nle, NFT_EXPR_META_KEY),
 			       expr);
 	expr_set_type(expr, stmt->meta.tmpl->dtype, stmt->meta.tmpl->byteorder);
 
Signature · 6 lines
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Florian Westphal

We segfault on 'list filter' when meta expr is used as _u8 returns invalid register 0.

This seems to only affect the master branch. Not sure how many people are using that and if its worth doing a new release. I'd rather merge the next-3.14 branch and have people use that.

Please, go ahead with that.

Quoted 3 lines

On a side note: there's no reason to have our releases timed after kernel releases. At this point I'd rather go for more frequent releases of the current code instead of backporting fixes.

We can probably point to the nftables git snapshots from the website and make the releases when we consider that there a good number of relevant changes/fixes to make an announce.

#3 lore raw
Quoted 10 lines · Pablo Neira Ayuso
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Florian Westphal

We segfault on 'list filter' when meta expr is used as _u8 returns invalid register 0.

This seems to only affect the master branch. Not sure how many people are using that and if its worth doing a new release. I'd rather merge the next-3.14 branch and have people use that.

Please, go ahead with that.

Done.

Quoted 7 lines
Quoted 3 lines

On a side note: there's no reason to have our releases timed after kernel releases. At this point I'd rather go for more frequent releases of the current code instead of backporting fixes.

We can probably point to the nftables git snapshots from the website and make the releases when we consider that there a good number of relevant changes/fixes to make an announce.

Yeah, we can switch to a different model once things have calmed down a little. Probably still should aim for a new release by 3.14, maybe earlier, so people can use the new stuff.

author maintainer
#4 lore raw
In reply to Patrick McHardy
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Florian Westphal

We segfault on 'list filter' when meta expr is used as _u8 returns invalid register 0.

This seems to only affect the master branch. Not sure how many people are using that and if its worth doing a new release. I'd rather merge the next-3.14 branch and have people use that.

I am now on 0545e0c13b as head but I still get segfault:

$ nft add rule filter output meta  mark set 42
$ nft list table -> segv

.. and my patch should still apply afaics.

#5 lore raw
Quoted 9 lines · Florian Westphal
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Florian Westphal

We segfault on 'list filter' when meta expr is used as _u8 returns invalid register 0.

This seems to only affect the master branch. Not sure how many people are using that and if its worth doing a new release. I'd rather merge the next-3.14 branch and have people use that.

Quoted 6 lines

I am now on 0545e0c13b as head but I still get segfault:

$ nft add rule filter output meta  mark set 42
$ nft list table -> segv

.. and my patch should still apply afaics.

I'm going to apply your patch to master. Thanks Florian.

#6 lore raw
In reply to Florian Westphal
Quoted 9 lines · Florian Westphal
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Florian Westphal

We segfault on 'list filter' when meta expr is used as _u8 returns invalid register 0.

This seems to only affect the master branch. Not sure how many people are using that and if its worth doing a new release. I'd rather merge the next-3.14 branch and have people use that.

Quoted 6 lines

I am now on 0545e0c13b as head but I still get segfault:

$ nft add rule filter output meta  mark set 42
$ nft list table -> segv

.. and my patch should still apply afaics.

Right, we've fixed that for other types. Please push your patch to master.

We should probably add a big warning to libnftnl for these cases or even an assert() since its misuse of the API that leads to hard to debug problems.

#7 lore raw
Quoted 15 lines · Patrick McHardy
Quoted 14 lines · Florian Westphal
Quoted 7 lines · Patrick McHardy
Quoted 2 lines · Florian Westphal

We segfault on 'list filter' when meta expr is used as _u8 returns invalid register 0.

This seems to only affect the master branch. Not sure how many people are using that and if its worth doing a new release. I'd rather merge the next-3.14 branch and have people use that.

I am now on 0545e0c13b as head but I still get segfault:

$ nft add rule filter output meta  mark set 42
$ nft list table -> segv
Quoted 7 lines
Quoted 1 line

.. and my patch should still apply afaics.

Right, we've fixed that for other types. Please push your patch to master.

We should probably add a big warning to libnftnl for these cases or even an assert() since its misuse of the API that leads to hard to debug problems.

Indeed. I started a patch for that here but failed to find time so far to finish it, it should help to catch wrong API uses.