Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jan 2025 02:31:57 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4c0e435bfbad - main - unix: avoid VNET recursion in unp_connectat()
Message-ID:  <202501170231.50H2VvoQ044509@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=4c0e435bfbad52358ad6c6508cf3dca2e7b45227

commit 4c0e435bfbad52358ad6c6508cf3dca2e7b45227
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-17 02:31:15 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-17 02:31:15 +0000

    unix: avoid VNET recursion in unp_connectat()
    
    While that might be a cool feature, but you can't connect two sockets in
    different VNETs.  It is just technically impossible right now.  This
    CURVNET_SET() was always setting the same context.
---
 sys/kern/uipc_usrreq.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 3d7e5bcc5ad0..c1f1c07da268 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1897,6 +1897,8 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam,
 	int error, len;
 	bool connreq;
 
+	CURVNET_ASSERT_SET();
+
 	if (nam->sa_family != AF_UNIX)
 		return (EAFNOSUPPORT);
 	if (nam->sa_len > sizeof(struct sockaddr_un))
@@ -1991,11 +1993,9 @@ unp_connectat(int fd, struct socket *so, struct sockaddr *nam,
 		goto bad2;
 	}
 	if (connreq) {
-		if (SOLISTENING(so2)) {
-			CURVNET_SET(so2->so_vnet);
+		if (SOLISTENING(so2))
 			so2 = sonewconn(so2, 0);
-			CURVNET_RESTORE();
-		} else
+		else
 			so2 = NULL;
 		if (so2 == NULL) {
 			error = ECONNREFUSED;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501170231.50H2VvoQ044509>