linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Qian Cai <cai@lca.pw>, davem@davemloft.net
Cc: alexander.h.duyck@linux.intel.com, kuznet@ms2.inr.ac.ru,
	kuba@kernel.org, yoshfuji@linux-ipv6.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipv4: fix a RCU-list bug in inet_dump_fib()
Date: Thu, 19 Mar 2020 16:32:15 -0600	[thread overview]
Message-ID: <3804be39-c185-592d-852d-3e91d4231b55@gmail.com> (raw)
In-Reply-To: <20200319221141.8814-1-cai@lca.pw>

On 3/19/20 4:11 PM, Qian Cai wrote:
> There is a place,
> 
> inet_dump_fib()
>   fib_table_dump
>     fn_trie_dump_leaf()
>       hlist_for_each_entry_rcu()
> 
> without rcu_read_lock() triggers a warning,
> 
>  WARNING: suspicious RCU usage
>  -----------------------------
>  net/ipv4/fib_trie.c:2216 RCU-list traversed in non-reader section!!
> 
>  other info that might help us debug this:
> 
>  rcu_scheduler_active = 2, debug_locks = 1
>  1 lock held by ip/1923:
>   #0: ffffffff8ce76e40 (rtnl_mutex){+.+.}, at: netlink_dump+0xd6/0x840
> 
>  Call Trace:
>   dump_stack+0xa1/0xea
>   lockdep_rcu_suspicious+0x103/0x10d
>   fn_trie_dump_leaf+0x581/0x590
>   fib_table_dump+0x15f/0x220
>   inet_dump_fib+0x4ad/0x5d0
>   netlink_dump+0x350/0x840
>   __netlink_dump_start+0x315/0x3e0
>   rtnetlink_rcv_msg+0x4d1/0x720
>   netlink_rcv_skb+0xf0/0x220
>   rtnetlink_rcv+0x15/0x20
>   netlink_unicast+0x306/0x460
>   netlink_sendmsg+0x44b/0x770
>   __sys_sendto+0x259/0x270
>   __x64_sys_sendto+0x80/0xa0
>   do_syscall_64+0x69/0xf4
>   entry_SYSCALL_64_after_hwframe+0x49/0xb3
> 

Fixes: 18a8021a7be3 ("net/ipv4: Plumb support for filtering route dumps")

but you have a problem below ...

> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>  net/ipv4/fib_frontend.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
> index 577db1d50a24..5e441282d647 100644
> --- a/net/ipv4/fib_frontend.c
> +++ b/net/ipv4/fib_frontend.c
> @@ -987,6 +987,8 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
>  	if (filter.flags & RTM_F_PREFIX)
>  		return skb->len;
>  
> +	rcu_read_lock();
> +
>  	if (filter.table_id) {
>  		tb = fib_get_table(net, filter.table_id);
>  		if (!tb) {

this branch has 2 return points which now have rcu_read_lock; you should
have seen this when you tested the change..



  parent reply	other threads:[~2020-03-19 22:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 22:11 [PATCH] ipv4: fix a RCU-list bug in inet_dump_fib() Qian Cai
2020-03-19 22:15 ` Qian Cai
2020-03-19 22:32 ` David Ahern [this message]
2020-03-25  3:04 ` [ipv4] f3f6f46e79: kernel-selftests.net.pmtu.sh.fail kernel test robot

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=3804be39-c185-592d-852d-3e91d4231b55@gmail.com \
    --to=dsahern@gmail.com \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=cai@lca.pw \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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).