netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gao feng <gaofeng@cn.fujitsu.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] ulog: add protection when remove ipt_ULOG
Date: Tue, 19 Feb 2013 09:09:02 +0800	[thread overview]
Message-ID: <5122D0AE.7060405@cn.fujitsu.com> (raw)
In-Reply-To: <20130218165230.GA19791@localhost>

On 2013/02/19 00:52, Pablo Neira Ayuso wrote:
> On Mon, Feb 18, 2013 at 11:57:36AM +0800, Gao feng wrote:
> [...]
>>> I think this is very unlikely to happen. The removal of the module
>>> happens in user-context and the entire path to build and deliver the
>>> skb to user-space is protected is under spin_lock_bh, so scheduling
>>> is not possible.
>>
>> Doesn't spin_lock_bh only disable local cpu's bottom-half?
>> the task that remove the modules can run on other cpus at the same time.
>> I'm wrong?
> 
> That's right. But that will not happen since the removal of ipt_ULOG
> is protected by the module refcount, which is bumped for each iptables
> rule. So, you have to remove all rules using the ULOG target first to
> be able to rmmod that module, but then there is no chance to race with
> packets.

this calltrack doesn't add the refcount of moudule.
trace_packet->nf_log_packet->logger->logfn(ipt_logfn).
But when removing module,we call nf_log_unregister and
we can make sure only ulog_tg_exit uses ulog_buffer->skb,
So it's safe to don't add spin lock protect here.

I will send a v2 patchset to remove the spin lock protect
in ebt_ulog module.

Thanks!

  reply	other threads:[~2013-02-19  1:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05  1:57 [PATCH] ulog: add protection when remove ipt_ULOG Gao feng
2013-02-05  2:48 ` [PATCH 2/2] netfilter: ipt_ULOG: make spinlock per nlgroup Gao feng
2013-03-15 11:51   ` Pablo Neira Ayuso
2013-03-18  9:11     ` Gao feng
2013-02-07 18:27 ` [PATCH] ulog: add protection when remove ipt_ULOG Pablo Neira Ayuso
2013-02-18  3:57   ` Gao feng
2013-02-18 16:52     ` Pablo Neira Ayuso
2013-02-19  1:09       ` Gao feng [this message]
2013-03-15 11:49 ` Pablo Neira Ayuso

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=5122D0AE.7060405@cn.fujitsu.com \
    --to=gaofeng@cn.fujitsu.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).