netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: David Miller <davem@davemloft.net>
Cc: akpm@linux-foundation.org, netdev@vger.kernel.org,
	kaber@trash.net, dipankar@in.ibm.com, paulmck@us.ibm.com
Subject: Re: [patch 11/11] netfilter warning fix
Date: Tue, 6 Feb 2007 22:58:06 +0100	[thread overview]
Message-ID: <20070206215806.GA5109@elte.hu> (raw)
In-Reply-To: <20070206.132357.58458400.davem@davemloft.net>


* David Miller <davem@davemloft.net> wrote:

> From: Ingo Molnar <mingo@elte.hu>
> Date: Tue, 6 Feb 2007 22:02:51 +0100
> 
> > So i'm wondering what other assumptions there are (or can be) about 
> > rcu_read_lock() also being a preempt-off point. Thanks!
> 
> I showed the examples in my detailed analysis yesterday.
> 
> Beause I love hearing myself say the same thing over and over so much 
> I'll restate it for you.
> 
> net/netfilter/nf_conntrack_core.c, calls:
> 
> 	l4proto = __nf_ct_l4proto_find((u_int16_t)pf, protonum);
> 
> whichs assumes that preemption is disabled.

you are right - i mistakenly read that mail only up to the point where 
you point out the (slightly) buggy NF_CT_STATIC_INC use and missed your 
final point about other coding having implicit preempt_disable() 
assumptions.

I've looked at __nf_ct_l4proto_find() and it's not obvious to me what 
the hidden preempt_disable() assumption is. Its main use seems to be of 
nf_ct_protos[] array, which is protected by nf_conntrack_lock. I'm 
wondering whether what you say suggests that it's safe to call 
__nf_ct_l4proto_find() without the nf_conntrack_lock locked (as read or 
as write), and if it's safe, how it protects against simultaneous 
modifications to the nf_ct_protos[] array. 

Ahh ... unregister does a synchronize_net(), right? That means that 
removal of the pointer only happens if all CPUs have gone through a 
quiescent state.

this means that this particular use could be fixed by converting the 
preempt_disable()/enable() pair in nf_ct_l4proto_find_get() to 
rcu_read_lock()/unlock(), correct? Furthermore, every user of 
synchronize_net() [and synchronize_rcu() in general] needs to be 
reviewed.

	Ingo

  reply	other threads:[~2007-02-06 21:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-06  0:31 [patch 11/11] netfilter warning fix akpm
2007-02-06  2:10 ` David Miller
2007-02-06  2:18   ` Andrew Morton
2007-02-06  2:44     ` David Miller
2007-02-06  2:53       ` Andrew Morton
2007-02-06 12:34         ` Ingo Molnar
2007-02-06 19:43           ` David Miller
2007-02-06 21:02             ` Ingo Molnar
2007-02-06 21:23               ` David Miller
2007-02-06 21:58                 ` Ingo Molnar [this message]
2007-02-07  6:43                   ` Patrick McHardy
2007-02-07  8:07                     ` Ingo Molnar
2007-02-07  8:13                       ` David Miller
2007-02-07  8:16                         ` Patrick McHardy
2007-02-07  8:18                           ` Ingo Molnar
2007-02-06  9:21       ` Martin Josefsson

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=20070206215806.GA5109@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=dipankar@in.ibm.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    --cc=paulmck@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;
as well as URLs for NNTP newsgroup(s).