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: <625c9519-7ae6-43a3-a5d0-81164ad7fd0e@yandex.ru>
Date: Tue, 5 Mar 2024 19:39:11 +0300
From: Dmitry Antipov <dmantipov@...dex.ru>
To: Wen Gu <guwen@...ux.alibaba.com>
Cc: Wenjia Zhang <wenjia@...ux.ibm.com>, Jan Karcher <jaka@...ux.ibm.com>,
 "D. Wythe" <alibuda@...ux.alibaba.com>, linux-s390@...r.kernel.org,
 netdev@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: Reaching official SMC maintainers

On 3/4/24 13:51, Wen Gu wrote:

> IMHO, if we want to address the problem of fasync_struct entries being
> incorrectly inserted to old socket, we may have to change the general code.

BTW what about using shared wait queue? Just to illustrate an idea:

diff --git a/include/linux/net.h b/include/linux/net.h
index c9b4a63791a4..02df64747db7 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -126,6 +126,7 @@ struct socket {
  	const struct proto_ops	*ops; /* Might change with IPV6_ADDRFORM or MPTCP. */

  	struct socket_wq	wq;
+	struct socket_wq	*shared_wq;
  };

  /*
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 0f53a5c6fd9d..f04d61e316b2 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -3360,6 +3360,9 @@ static int __smc_create(struct net *net, struct socket *sock, int protocol,
  		smc->clcsock = clcsock;
  	}

+	sock->shared_wq = &smc->shared_wq;
+	smc->clcsock->shared_wq = &smc->shared_wq;
+
  out:
  	return rc;
  }
diff --git a/net/smc/smc.h b/net/smc/smc.h
index df64efd2dee8..26e66c289d4f 100644
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -287,6 +287,7 @@ struct smc_sock {				/* smc sock container */
  						/* protects clcsock of a listen
  						 * socket
  						 * */
+	struct socket_wq	shared_wq;
  };

  #define smc_sk(ptr) container_of_const(ptr, struct smc_sock, sk)
diff --git a/net/socket.c b/net/socket.c
index ed3df2f749bf..9b9e6932906f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1437,7 +1437,8 @@ static int sock_fasync(int fd, struct file *filp, int on)
  {
  	struct socket *sock = filp->private_data;
  	struct sock *sk = sock->sk;
-	struct socket_wq *wq = &sock->wq;
+	struct socket_wq *wq = (unlikely(sock->shared_wq) ?
+				sock->shared_wq : &sock->wq);

  	if (sk == NULL)
  		return -EINVAL;

Dmitry


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ