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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc67444d-3311-43b0-8f68-131e1ef490c7@redhat.com>
Date: Thu, 24 Apr 2025 10:19:17 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>
Cc: Simon Horman <horms@...nel.org>, Kuniyuki Iwashima <kuni1840@...il.com>,
 netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next 6/7] neighbour: Convert RTM_GETNEIGHTBL to
 RCU.

On 4/18/25 3:26 AM, Kuniyuki Iwashima wrote:
> neightbl_dump_info() calls neightbl_fill_info() and

AFAICS neightbl_fill_info() is only invoked from neightbl_dump_info()
and acquires/releases the RCU internally. Such lock pair should be dropped.

> neightbl_fill_param_info() for each neigh_tables[] entry.
> 
> Both functions rely on the table lock (read_lock_bh(&tbl->lock)),
> so RTNL is not needed.
> 
> Let's fetch the table under RCU and convert RTM_GETNEIGHTBL to RCU.
> 
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
>  net/core/neighbour.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index ccfef86bb044..38732d8f0ed7 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -2467,10 +2467,12 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
>  
>  	family = ((struct rtgenmsg *)nlmsg_data(nlh))->rtgen_family;
>  
> +	rcu_read_lock();
> +
>  	for (tidx = 0; tidx < NEIGH_NR_TABLES; tidx++) {
>  		struct neigh_parms *p;
>  
> -		tbl = rcu_dereference_rtnl(neigh_tables[tidx]);
> +		tbl = rcu_dereference(neigh_tables[tidx]);
>  		if (!tbl)
>  			continue;

Later statements:

		p = list_next_entry(&tbl->parms, list);
		list_for_each_entry_from(p, &tbl->parms_list, list) {

are now without any protection, and AFAICS parms_list is write protected
by tbl->lock. I think it's necessary to move the
read_lock_bh(&tbl->lock) from neightbl_fill_param_info() to
neightbl_dump_info() ?!?

Side note: I guess it would be to follow-up replacing R/W lock with
plain spinlock/rcu?!?

Thanks!

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ