lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <7548E652-5F70-4920-9EC6-CAB469D0BD35@lca.pw>
Date:   Thu, 19 Mar 2020 18:15:04 -0400
From:   Qian Cai <cai@....pw>
To:     David Miller <davem@...emloft.net>
Cc:     alexander.h.duyck@...ux.intel.com, kuznet@....inr.ac.ru,
        kuba@...nel.org, yoshfuji@...ux-ipv6.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ipv4: fix a RCU-list bug in inet_dump_fib()



> On Mar 19, 2020, at 6:11 PM, Qian Cai <cai@....pw> 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
> 
> Signed-off-by: Qian Cai <cai@....pw>

Self-NAK. I forgot to unlock. Will send a v2.

> ---
> 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) {
> @@ -1004,8 +1006,6 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
> 	s_h = cb->args[0];
> 	s_e = cb->args[1];
> 
> -	rcu_read_lock();
> -
> 	for (h = s_h; h < FIB_TABLE_HASHSZ; h++, s_e = 0) {
> 		e = 0;
> 		head = &net->ipv4.fib_table_hash[h];
> -- 
> 2.21.0 (Apple Git-122.2)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ