From: David Miller <davem@davemloft.net>
To: akpm@linux-foundation.org
Cc: netdev@vger.kernel.org, kaber@trash.net, dipankar@in.ibm.com,
paulmck@us.ibm.com, mingo@elte.hu
Subject: Re: [patch 11/11] netfilter warning fix
Date: Mon, 05 Feb 2007 18:44:08 -0800 (PST) [thread overview]
Message-ID: <20070205.184408.34759062.davem@davemloft.net> (raw)
In-Reply-To: <20070205181810.bbfbf42c.akpm@linux-foundation.org>
From: Andrew Morton <akpm@linux-foundation.org>
Date: Mon, 5 Feb 2007 18:18:10 -0800
> I think the finger was pointed at preemptible rcu, in -mm. iirc,
> the net stats code is assuming that rcu_read_lock() disables
> preemption as a side-effect, which rcu-preempt makes no-longer-true.
>
> Not sure what to do there. Perhaps add a new
> rcu_read_lock_with_preempt_disable() thing which will dtrt with
> either config.
Hmmm, really?
Let's audit NF_CT_STAT_INC() usage to make sure :-)
net/netfilter/nf_conntrack_core.c:
destroy_conntrack: Inside write_{lock,unlock}_bh().
death_by_timeout: Ditto.
__nf_conntrack_find: Inside read_{lock,unlock}_bh() via callers.
__nf_conntrack_confirm: Inside write_{lock,unlock}_bh().
early_drop: This one looks like it could be unprotected.
init_conntrack: Inside of write_{lock,unlock}_bh().
nf_conntrack_in: Packet receive path, softints disabled.
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c:
ipv6_prepare: Packet input path, BH's disabled.
net/netfilter/nf_conntrack_expect.c:
nf_ct_unlink_expect: Inside if write_{lock,unlock}_bh() via callers.
nf_conntrack_expect_insert: Ditto.
So that leaves early_drop() as the only suspicious case that might
not run inside of disabled BH's.
And in fact that case is a bug regardless of the preemptible rcu
changes because this allows the counter bump to be corrupted by
software interrupt context.
And OK, I see in the lockdep trace that it's the packet transmit
path... In fact, this assumption of preemption being disabled
by the netfilter top-level dispatch is very deep.
For example, several bits besides the NF_CT_STATIC_INC of
nf_conntrack_in() (where the lockdep trigger backtrace hits) assume
that preemption is enabled by that rcu_read_lock() in the top-level
netfilter dispatch.
The __nf_ct_l{3,4}proto_find() calls there are just two examples.
I imagine this assumption is quite pervasive throughout the
netfilter code, so just patching up this NF_CT_STAT_INC() case
will merely shut up lockdep and paper over the issue.
I bet this rcu_read_lock()-implies-preempt_disable() assumption has
spread into other areas of the tree as well.
next prev parent reply other threads:[~2007-02-06 2:44 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 [this message]
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
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=20070205.184408.34759062.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=akpm@linux-foundation.org \
--cc=dipankar@in.ibm.com \
--cc=kaber@trash.net \
--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).