From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Gergely Kalman <synapse@hippy.csoma.elte.hu>
Subject: Re: [PATCH] Fix RCU warning in rt_cache_seq_show
Date: Tue, 9 Aug 2011 18:11:06 -0700 [thread overview]
Message-ID: <20110810011106.GD2737@linux.vnet.ibm.com> (raw)
In-Reply-To: <1312910336.2371.61.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>
On Tue, Aug 09, 2011 at 07:18:56PM +0200, Eric Dumazet wrote:
> Le mardi 09 août 2011 à 18:02 +0100, Mark Rutland a écrit :
> > Commit f2c31e32 ("net: fix NULL dereferences in check_peer_redir()")
> > added rcu protection to dst neighbour, and updated callsites for
> > dst_{get,set}_neighbour. Unfortunately, it missed rt_cache_seq_show.
> >
> > This produces a warning on v3.1-rc1 (on a preemptible kernel, on an
> > ARM Vexpress A9x4):
> >
> > ===================================================
> > [ INFO: suspicious rcu_dereference_check() usage. ]
> > ---------------------------------------------------
> > include/net/dst.h:91 invoked rcu_dereference_check() without protection!
> >
> > other info that might help us debug this:
> >
> > rcu_scheduler_active = 1, debug_locks = 0
> > 2 locks held by proc01/32159:
This is very strange. It says that there are two locks held by the
task, but refuses to list them. Maybe something stomped on the list
of held locks?
Thanx, Paul
> > stack backtrace:
> > [<80014880>] (unwind_backtrace+0x0/0xf8) from [<802e5c78>] (rt_cache_seq_show+0x18c/0x1c4)
> > [<802e5c78>] (rt_cache_seq_show+0x18c/0x1c4) from [<800e0c5c>] (seq_read+0x324/0x4a4)
> > [<800e0c5c>] (seq_read+0x324/0x4a4) from [<8010786c>] (proc_reg_read+0x70/0x94)
> > [<8010786c>] (proc_reg_read+0x70/0x94) from [<800c0ba8>] (vfs_read+0xb0/0x144)
> > [<800c0ba8>] (vfs_read+0xb0/0x144) from [<800c0ea8>] (sys_read+0x40/0x70)
> > [<800c0ea8>] (sys_read+0x40/0x70) from [<8000e0c0>] (ret_fast_syscall+0x0/0x3c)
> >
> > This patch adds calls to rcu_read_{lock,unlock} in rt_cache_seq_show,
> > protecting the dereferenced variable, and clearing the warning.
> >
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > Cc: Eric Dumazet <eric.dumazet@gmail.com>
> > Cc: Gergely Kalman <synapse@hippy.csoma.elte.hu>
> > ---
> > net/ipv4/route.c | 2 ++
> > 1 files changed, 2 insertions(+), 0 deletions(-)
> >
> > diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> > index e3dec1c..6699ef7 100644
> > --- a/net/ipv4/route.c
> > +++ b/net/ipv4/route.c
> > @@ -419,6 +419,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
> > struct neighbour *n;
> > int len;
> >
> > + rcu_read_lock();
> > n = dst_get_neighbour(&r->dst);
> > seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t"
> > "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n",
> > @@ -435,6 +436,7 @@ static int rt_cache_seq_show(struct seq_file *seq, void *v)
> > -1,
> > (n && (n->nud_state & NUD_CONNECTED)) ? 1 : 0,
> > r->rt_spec_dst, &len);
> > + rcu_read_unlock();
> >
> > seq_printf(seq, "%*s\n", 127 - len, "");
> > }
>
>
> Hmm, I though rcu_read_lock_bh() (done by caller of this function) was
> protecting us here.
>
>
> Paul, is it really needed, or is it a lockdep artifact ?
>
>
>
>
>
next prev parent reply other threads:[~2011-08-10 1:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-09 17:02 [PATCH] Fix RCU warning in rt_cache_seq_show Mark Rutland
2011-08-09 17:18 ` Eric Dumazet
2011-08-10 1:11 ` Paul E. McKenney [this message]
[not found] ` <4e424f6c.12cde30a.131e.ffffec9bSMTPIN_ADDED@mx.google.com>
2011-08-11 16:58 ` Eric Dumazet
2011-08-12 2:32 ` Paul E. McKenney
2011-08-12 7:23 ` Eric Dumazet
2011-08-12 12:49 ` Paul E. McKenney
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=20110810011106.GD2737@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=synapse@hippy.csoma.elte.hu \
/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).