From: Patrick McHardy <kaber@trash.net>
To: Ingo Molnar <mingo@elte.hu>
Cc: David Miller <davem@davemloft.net>,
akpm@linux-foundation.org, netdev@vger.kernel.org,
dipankar@in.ibm.com, paulmck@us.ibm.com
Subject: Re: [patch 11/11] netfilter warning fix
Date: Wed, 07 Feb 2007 07:43:09 +0100 [thread overview]
Message-ID: <45C974FD.5070404@trash.net> (raw)
In-Reply-To: <20070206215806.GA5109@elte.hu>
Ingo Molnar wrote:
> * David Miller <davem@davemloft.net> wrote:
>
>>net/netfilter/nf_conntrack_core.c, calls:
>>
>> l4proto = __nf_ct_l4proto_find((u_int16_t)pf, protonum);
>>
>>whichs assumes that preemption is disabled.
Yes, that is certainly broken.
> 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?
That is another bug (all uses of preempt_disable in netfilter
actually), but calling __nf_ct_l[34]proto_find without
rcu_read_lock is broken as well.
> Furthermore, every user of
> synchronize_net() [and synchronize_rcu() in general] needs to be
> reviewed.
I'll take care of netfilter.
next prev parent reply other threads:[~2007-02-07 6:43 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
2007-02-07 6:43 ` Patrick McHardy [this message]
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=45C974FD.5070404@trash.net \
--to=kaber@trash.net \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=dipankar@in.ibm.com \
--cc=mingo@elte.hu \
--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).