Linux Netfilter development
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Liping Zhang <zlpnobody@163.com>
Cc: netfilter-devel@vger.kernel.org, dalegaard@gmail.com,
	Liping Zhang <zlpnobody@gmail.com>
Subject: Re: [PATCH nf] netfilter: nf_tables: fix oops when inserting an element into a verdict map
Date: Wed, 9 Nov 2016 00:05:42 +0100	[thread overview]
Message-ID: <20161108230542.GA31399@salvia> (raw)
In-Reply-To: <1478414401-21488-1-git-send-email-zlpnobody@163.com>

On Sun, Nov 06, 2016 at 02:40:01PM +0800, Liping Zhang wrote:
> From: Liping Zhang <zlpnobody@gmail.com>
> 
> Dalegaard says:
>  The following ruleset, when loaded with 'nft -f bad.txt'
>  ----snip----
>  flush ruleset
>  table ip inlinenat {
>    map sourcemap {
>      type ipv4_addr : verdict;
>    }
> 
>    chain postrouting {
>      ip saddr vmap @sourcemap accept
>    }
>  }
>  add chain inlinenat test
>  add element inlinenat sourcemap { 100.123.10.2 : jump test }
>  ----snip----
> 
>  results in a kernel oops:
>  BUG: unable to handle kernel paging request at 0000000000001344
>  IP: [<ffffffffa07bf704>] nf_tables_check_loops+0x114/0x1f0 [nf_tables]
>  [...]
>  Call Trace:
>   [<ffffffffa07c2aae>] ? nft_data_init+0x13e/0x1a0 [nf_tables]
>   [<ffffffffa07c1950>] nft_validate_register_store+0x60/0xb0 [nf_tables]
>   [<ffffffffa07c74b5>] nft_add_set_elem+0x545/0x5e0 [nf_tables]
>   [<ffffffffa07bfdd0>] ? nft_table_lookup+0x30/0x60 [nf_tables]
>   [<ffffffff8132c630>] ? nla_strcmp+0x40/0x50
>   [<ffffffffa07c766e>] nf_tables_newsetelem+0x11e/0x210 [nf_tables]
>   [<ffffffff8132c400>] ? nla_validate+0x60/0x80
>   [<ffffffffa030d9b4>] nfnetlink_rcv+0x354/0x5a7 [nfnetlink]
> 
> Because we forget to fill the net pointer in bind_ctx, so dereferencing
> it may cause kernel crash.

Applied, thanks for fixing up this, that was fast.

      parent reply	other threads:[~2016-11-08 23:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-06  6:40 [PATCH nf] netfilter: nf_tables: fix oops when inserting an element into a verdict map Liping Zhang
2016-11-07 10:58 ` Arturo Borrero Gonzalez
2016-11-07 12:52   ` Liping Zhang
2016-11-08 23:05 ` Pablo Neira Ayuso [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=20161108230542.GA31399@salvia \
    --to=pablo@netfilter.org \
    --cc=dalegaard@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=zlpnobody@163.com \
    --cc=zlpnobody@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox