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: <20240128091758.9206-1-kuniyu@amazon.com>
Date: Sun, 28 Jan 2024 01:17:58 -0800
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <kent.overstreet@...ux.dev>
CC: <boqun.feng@...il.com>, <linux-fsdevel@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
	<peterz@...radead.org>, <kuniyu@...zon.com>
Subject: Re: [PATCH 3/4] net: Convert sk->sk_peer_lock to lock_set_cmp_fn_ptr_order()

From: Kent Overstreet <kent.overstreet@...ux.dev>
Date: Fri, 26 Jan 2024 21:08:30 -0500
> Cc: netdev@...r.kernel.org
> Signed-off-by: Kent Overstreet <kent.overstreet@...ux.dev>
> ---
>  net/core/sock.c    | 1 +
>  net/unix/af_unix.c | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/sock.c b/net/core/sock.c
> index 158dbdebce6a..da7360c0f454 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -3474,6 +3474,7 @@ void sock_init_data_uid(struct socket *sock, struct sock *sk, kuid_t uid)
>  	sk->sk_peer_pid 	=	NULL;
>  	sk->sk_peer_cred	=	NULL;
>  	spin_lock_init(&sk->sk_peer_lock);
> +	lock_set_cmp_fn_ptr_order(&sk->sk_peer_lock);
>  
>  	sk->sk_write_pending	=	0;
>  	sk->sk_rcvlowat		=	1;
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index ac1f2bc18fc9..d013de3c5490 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -706,10 +706,10 @@ static void copy_peercred(struct sock *sk, struct sock *peersk)
>  
>  	if (sk < peersk) {
>  		spin_lock(&sk->sk_peer_lock);
> -		spin_lock_nested(&peersk->sk_peer_lock, SINGLE_DEPTH_NESTING);
> +		spin_lock(&peersk->sk_peer_lock);
>  	} else {
>  		spin_lock(&peersk->sk_peer_lock);
> -		spin_lock_nested(&sk->sk_peer_lock, SINGLE_DEPTH_NESTING);
> +		spin_lock(&sk->sk_peer_lock);
>  	}

hmm.. I think we need not hold two locks here in the first place.
Let me post patches.

Thanks!


>  	old_pid = sk->sk_peer_pid;
>  	old_cred = sk->sk_peer_cred;
> -- 
> 2.43.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ