public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: David Wilder <dwilder@us.ibm.com>
Cc: netdev@vger.kernel.org, netfilter-devel@vger.kernel.org,
	fw@strlen.de, wilder@us.ibm.com, mkubecek@suse.com
Subject: Re: [PATCH v1 0/4] iptables: Module unload causing NULL pointer reference.
Date: Wed, 24 Jun 2020 14:05:49 +0200	[thread overview]
Message-ID: <20200624120549.GA27711@salvia> (raw)
In-Reply-To: <20200622171014.975-1-dwilder@us.ibm.com>

On Mon, Jun 22, 2020 at 10:10:10AM -0700, David Wilder wrote:
> A crash happened on ppc64le when running ltp network tests triggered by "rmmod iptable_mangle".
> 
> See previous discussion in this thread: https://lists.openwall.net/netdev/2020/06/03/161 .
> 
> In the crash I found in iptable_mangle_hook() that state->net->ipv4.iptable_mangle=NULL causing a NULL pointer dereference. net->ipv4.iptable_mangle is set to NULL in iptable_mangle_net_exit() and called when ip_mangle modules is unloaded. A rmmod task was found running in the crash dump.  A 2nd crash showed the same problem when running "rmmod iptable_filter" (net->ipv4.iptable_filter=NULL).
> 
> To fix this I added .pre_exit hook in all iptable_foo.c. The pre_exit will un-register the underlying hook and exit would do the table freeing. The netns core does an unconditional synchronize_rcu after the pre_exit hooks insuring no packets are in flight that have picked up the pointer before completing the un-register.
> 
> These patches include changes for both iptables and ip6tables.
> 
> We tested this fix with ltp running iptables01.sh and iptables01.sh -6 a loop for 72 hours.

Series applied, thanks.

      parent reply	other threads:[~2020-06-24 12:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 17:10 [PATCH v1 0/4] iptables: Module unload causing NULL pointer reference David Wilder
2020-06-22 17:10 ` [PATCH v1 1/4] netfilter: Split ipt_unregister_table() into pre_exit and exit helpers David Wilder
2020-06-22 17:10 ` [PATCH v1 2/4] netfilter: Add a .pre_exit hook in all iptable_foo.c David Wilder
2020-06-22 17:10 ` [PATCH v1 3/4] netfilter: Split ip6t_unregister_table() into pre_exit and exit helpers David Wilder
2020-06-22 17:10 ` [PATCH v1 4/4] netfilter: Add a .pre_exit hook in all ip6table_foo.c David Wilder
2020-06-24 12: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=20200624120549.GA27711@salvia \
    --to=pablo@netfilter.org \
    --cc=dwilder@us.ibm.com \
    --cc=fw@strlen.de \
    --cc=mkubecek@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=wilder@us.ibm.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