From nobody Fri Jan 17 02:31:57 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YZ3f53kyFz5kGVy; Fri, 17 Jan 2025 02:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YZ3f51s9rz3cMX; Fri, 17 Jan 2025 02:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737081117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gv6kjQp/agWfBOgmt2LpIwHrVnE/crp8gzZIZ0eNdEM=; b=TcQ09zr0quTqtB+I1ysV41T8j0vncuwFDSwQAatlzCruPB1alouUpfysUIDtcM51IgIQfn Kf/co7sYUUDPhNtTzk0r7d3N1SMznpJXK8dOy9YbJWH5yjA08iqLCGYw1d/E7QUMC8Gi26 brRiYJ4NgSpuqrxsk/t3teXj92DIol5Qaixn2QRyRzQrSc6O2kvRAomZemxD5zXiCDVY/a QTZr5l1XyzdP2qB0eSnBXI3ELts5FpInLrUCnXAujfe9Eyb+e1y4AdkDWCy1j9qbR/0vVM OoaKhUvcPkBQtSHbCtGwqwadAEbUfVa6DOmg50b2hiAmOp0oaWjrzLZxhFvK6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737081117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Gv6kjQp/agWfBOgmt2LpIwHrVnE/crp8gzZIZ0eNdEM=; b=o1qnFwfZk/Y/4kdjthKnzXSA8FPHALoD6asJx7w9u10pVM7tJG8/3jrdJfq/iYorJ2VpI6 EQ63BKXATkAzIwYVqAu4OkCjv9T2oWtlIIW5tFXJEp5bKVDGbqQgpNSB5YoZNoUNnxCWr6 99VBvzUeHMTMdDN4YQyKj7rTJQnwmHPR+4eYTMyZetdod1GjoKI1xHgDjW7V2OpvnD53Ox 3geqL7S+rB7VaKz+xnKS11CYK4hldiKa0rgv4h3pWSENyBaRkxVa3/YcktCZMdSlT37rAK CGu4BTrYXzSO3NSEL4R88XeKkE9yUWNoZj6SyYHso9RiuHDqzJdaTO/wUmRrhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737081117; a=rsa-sha256; cv=none; b=uxAtur1+Rv7xlNMg/6RHmKRDjg+P0GEoZ6IaUuozfQhvugisuKvDw4FT24qSwAu08DUaO5 68ia2oyJVvnQSxXGtmwOuqJnHG77l2g+GampaSYUbz0OMM1eVC7/Fi/j6VPRmB0wGyo7BY UmgrdyRIBHDfVS9mZJijeS5obONthjomKagKJ/cXcbLyYnA+smmGEpX0nNTQbyc3QCqoFZ OqBEz7+vcW0pMhUVMciBMXjhnhyG5h2SMPPAQmQq01Wrk6CuPHP4/gR6Ji5aWoBWLIs7Ct QPVwqi36zfi2CWNo1Jiv4j890xUyCXzIAkZvsDRu2irvQBqw7pgRTrcmuwpRlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YZ3f517PTz10Cm; Fri, 17 Jan 2025 02:31:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50H2VvmX044512; Fri, 17 Jan 2025 02:31:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50H2VvoQ044509; Fri, 17 Jan 2025 02:31:57 GMT (envelope-from git) Date: Fri, 17 Jan 2025 02:31:57 GMT Message-Id: <202501170231.50H2VvoQ044509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 4c0e435bfbad - main - unix: avoid VNET recursion in unp_connectat() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4c0e435bfbad52358ad6c6508cf3dca2e7b45227 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=4c0e435bfbad52358ad6c6508cf3dca2e7b45227 commit 4c0e435bfbad52358ad6c6508cf3dca2e7b45227 Author: Gleb Smirnoff AuthorDate: 2025-01-17 02:31:15 +0000 Commit: Gleb Smirnoff 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;