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] [day] [month] [year] [list]
Message-ID: <20240413021012.20209-1-kuniyu@amazon.com>
Date: Fri, 12 Apr 2024 19:10:12 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <kuba@...nel.org>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuni1840@...il.com>,
	<kuniyu@...zon.com>, <netdev@...r.kernel.org>, <oliver.sang@...el.com>,
	<pabeni@...hat.com>
Subject: Re: [PATCH v1 net-next] af_unix: Try not to hold unix_gc_lock during accept().

From: Jakub Kicinski <kuba@...nel.org>
Date: Fri, 12 Apr 2024 19:05:22 -0700
> On Wed, 10 Apr 2024 13:19:29 -0700 Kuniyuki Iwashima wrote:
> >  void unix_update_edges(struct unix_sock *receiver)
> >  {
> > -	spin_lock(&unix_gc_lock);
> > -	unix_update_graph(unix_sk(receiver->listener)->vertex);
> > +	/* nr_unix_fds is only updated under unix_state_lock().
> > +	 * If it's 0 here, the embryo socket is not part of the
> > +	 * inflight graph, and GC will not see it.
> > +	 */
> > +	bool need_lock = !!receiver->scm_stat.nr_unix_fds;
> > +
> > +	if (need_lock) {
> > +		spin_lock(&unix_gc_lock);
> > +		unix_update_graph(unix_sk(receiver->listener)->vertex);
> > +	}
> > +
> >  	receiver->listener = NULL;
> > -	spin_unlock(&unix_gc_lock);
> > +
> > +	if (need_lock)
> > +		spin_unlock(&unix_gc_lock);
> >  }
> 
> Are you planning to add more code here? I feel like the sharing of 
> a single line is outweighted by the conditionals.. I mean:
> 
> 	/* ...
> 	 */
> 	if (!receiver->scm_stat.nr_unix_fd) {
> 		receiver->listener = NULL;
> 	} else {
> 		spin_lock(&unix_gc_lock);
> 		unix_update_graph(unix_sk(receiver->listener)->vertex);
> 		receiver->listener = NULL;
> 		spin_unlock(&unix_gc_lock);
> 	}
> 
> no?

Ah exactly, I'll repsin v2 with that style.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ