netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: stranche@codeaurora.org
To: Florian Westphal <fw@strlen.de>
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org,
	lucien.xin@gmail.com, subashab@codeaurora.org
Subject: Re: [PATCH nf] Revert "netfilter: unlock xt_table earlier in __do_replace"
Date: Thu, 23 Jan 2020 13:08:14 -0700	[thread overview]
Message-ID: <41d1a7e128c92ac4cbc85806e0a09692@codeaurora.org> (raw)
In-Reply-To: <20200123102921.GU795@breakpoint.cc>

On 2020-01-23 03:29, Florian Westphal wrote:
> 
> I don't see how this changes anything wrt. packet path.
> This disallows another instance of iptables(-restore) to come in
> before the counters have been copied/freed and the destructors have 
> run.
> 
> But as those have nothing to do with the jumpstack I don't see how this
> helps.

Based on on the stack of the iptables-restore task that freed the 
jumpstack being accessed in the ipt_do_table() routine, we end up in 
__do_replace()
       0xFFFFFF9239243AE0, ->kvfree
       0xFFFFFF923A1969EC, ->xt_free_table_info+0x50
       0xFFFFFF923A2100E0, ->__do_replace+0x200

Prior to the original patch, this xt_free_table_info was under lock, so 
it seems that having this call under lock guarantees that the new 
table->private entry that contains the jumpstack is seen across all 
CPUs.

> 
> But the packet path doesn't grab the table mutex.
> 

Good point. Perhaps the reason that moving this lock helps is because it 
prevents multiple writers from stepping on one another in such a way 
that the private entry is left in a bad state. Or this whole thing is a 
red herring and the problem is actually that xt_replace_table() is able 
to return prematurely and not all CPUs are finished with the old 
jumpstack by the time the old table info is freed.

  reply	other threads:[~2020-01-23 20:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23  0:47 [PATCH nf] Revert "netfilter: unlock xt_table earlier in __do_replace" Sean Tranchetti
2020-01-23 10:29 ` Florian Westphal
2020-01-23 20:08   ` stranche [this message]
2020-02-03 10:51   ` Xin Long

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=41d1a7e128c92ac4cbc85806e0a09692@codeaurora.org \
    --to=stranche@codeaurora.org \
    --cc=fw@strlen.de \
    --cc=lucien.xin@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=subashab@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).