From: Florian Westphal <fw@strlen.de>
To: Fernando Fernandez Mancera <ffmancera@riseup.net>
Cc: Sergei Trofimovich <slyfox@gentoo.org>,
netfilter-devel@vger.kernel.org, Florian Westphal <fw@strlen.de>,
Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [PATCH] nftables: don't crash in 'list ruleset' if policy is not set
Date: Mon, 16 Sep 2019 09:52:56 +0200 [thread overview]
Message-ID: <20190916075256.GL10656@breakpoint.cc> (raw)
In-Reply-To: <801524a6-86ce-620b-f06e-9792a37786cb@riseup.net>
Fernando Fernandez Mancera <ffmancera@riseup.net> wrote:
> Hi Sergei,
>
> On 9/16/19 9:33 AM, Sergei Trofimovich wrote:
> > Minimal reproducer:
> >
> > ```
> > $ cat nft.ruleset
> > # filters
> > table inet filter {
> > chain prerouting {
> > type filter hook prerouting priority -50
> > }
> > }
> >
> > # dump new state
> > list ruleset
> >
> > $ nft -c -f ./nft.ruleset
> > table inet filter {
> > chain prerouting {
> > Segmentation fault (core dumped)
> > ```
> >
> > The crash happens in `chain_print_declaration()`:
> >
> > ```
> > if (chain->flags & CHAIN_F_BASECHAIN) {
> > mpz_export_data(&policy, chain->policy->value,
> > BYTEORDER_HOST_ENDIAN, sizeof(int));
> > ```
> >
> > Here `chain->policy` is `NULL` (as textual rule does not mention it).
> >
> > The change is not to print the policy if it's not set
> > (similar to `chain_evaluate()` handling).
>
> Thanks for fixing that. Sorry I missed that we could have a base chain
> without policy.
>
> Acked-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Applied, thanks.
prev parent reply other threads:[~2019-09-16 7:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-16 7:33 [PATCH] nftables: don't crash in 'list ruleset' if policy is not set Sergei Trofimovich
2019-09-16 7:41 ` Fernando Fernandez Mancera
2019-09-16 7:52 ` Florian Westphal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190916075256.GL10656@breakpoint.cc \
--to=fw@strlen.de \
--cc=ffmancera@riseup.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=slyfox@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.