From nobody Mon Jan 13 18:15:19 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 4YX0mS1ZCQz5kcd4; Mon, 13 Jan 2025 18:15:20 +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 4YX0mR6DH1z3L9M; Mon, 13 Jan 2025 18:15:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792119; 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=3OWxxXGVsZNedvDdQAMvOLMFAtkM85uFI4o+PGGkX24=; b=iqR62Y7CYLalpj2iF8HgrKITS79P6H/DnQzuilqlGfHa2sIQqNiFefDCp2rFKT3fSggD0k 7VbdcQiqYSFGs3wU9/RKOFewAdpZ9WljXoOPeQYRR5OqxahtmeabX644OYPN5MDIw46DIb wsC+72EfZ4sa3wumB/o1yUtpjNiHPhNvtQswtB2BbYoRfB06zlELdpM3AqgORCBdjWH1xs uUirGrYc+6yzfJj4/ZfAt93+oSO0hmg60HTAmbeuEu2wRKbukmCC9YjYAgRo4/6HtajRU8 0UYoxFkafiUyZe0DLRuhTJwdPlKAMn/mFERJrb2jjVH4jSMaM6nNqzFFKganIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792119; 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=3OWxxXGVsZNedvDdQAMvOLMFAtkM85uFI4o+PGGkX24=; b=JDstso0gV4V3FDyWiicspq4QTjUY/BpbrInR9q4i4NWytrNdpL0SZSbb9vLuWISeAbX+nm gr0QYmnAZZ2smTJx76BZ0Hhh5LwAEGpag4etAGkNsTCIIds/wVXL41iYDNBnlEo8oK3kao kTTuCqfuNlKz4YN6ASxVZ7nSHGneQh+urgHavt6bMiGZx3ivAE0HJcTMUeWYVn8x0+vJFG J5DUaFZgmHSEsGDxhtpMLy6IZWNXYPaQSW6yaaYUYJ0MK3ht3XB5qt2mVsjlcWnZbQG4lE o+EP6CW4TQlpHQ9xszEgpZnClClNAhDrnq4AoEdTB+w9p1lBnHj7PiJI2pr/tw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736792119; a=rsa-sha256; cv=none; b=kO0CFp0niO4LxdciIEwtM1xwPjtH4Hebhuz/LStP7SjJ8xYSAkUNecusGsCextzrZQTFgE 5wP2TCOzdLDRTum6VmFraPNNbriDoMTGUmvEEh/8JZSoRyQBAfDzGuErV/VLYans5yzm6C JFIIR/DmajfKOhGfD0Od5/tqqyk5TslJrvSD8bikqQcCcMA7Ve8BmLnH1reQtpQXtk/sIH eD/JyncCD8VTckoZTNsN4qAzYfylDgKBPqFmrYW2JSKWJLcNZCRZmhz7TIQnRJEG1LTbG6 fqGuX+dx5LZMWiUn3iuJ9oHe3eCgh6A0FI6Cu9lKzv8ELVCnlgZb76p19mwNPQ== 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 4YX0mR5qZyzhrH; Mon, 13 Jan 2025 18:15:19 +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 50DIFJ2q007986; Mon, 13 Jan 2025 18:15:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DIFJtu007983; Mon, 13 Jan 2025 18:15:19 GMT (envelope-from git) Date: Mon, 13 Jan 2025 18:15:19 GMT Message-Id: <202501131815.50DIFJtu007983@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: 59498e099cc0 - main - sockets: virtualize kern.ipc.numopensockets 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: 59498e099cc055da7afca8266087b7668be6d7cb Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=59498e099cc055da7afca8266087b7668be6d7cb commit 59498e099cc055da7afca8266087b7668be6d7cb Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:08:58 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 18:11:46 +0000 sockets: virtualize kern.ipc.numopensockets To avoid breaking POLA on the host machine it reports the same value as before. In a VNET jail it now reports number of sockets in this jail. PR: 219655 Differential Revision: https://reviews.freebsd.org/D48315 --- sys/kern/uipc_socket.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 7a76b561389a..426316ac6ce8 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -275,9 +275,23 @@ SYSCTL_PROC(_kern_ipc, KIPC_SOMAXCONN, somaxconn, sizeof(u_int), sysctl_somaxconn, "IU", "Maximum listen socket pending connection accept queue size (compat)"); -static int numopensockets; -SYSCTL_INT(_kern_ipc, OID_AUTO, numopensockets, CTLFLAG_RD, - &numopensockets, 0, "Number of open sockets"); +static u_int numopensockets; +static int +sysctl_numopensockets(SYSCTL_HANDLER_ARGS) +{ + u_int val; + +#ifdef VIMAGE + if(!IS_DEFAULT_VNET(curvnet)) + val = curvnet->vnet_sockcnt; + else +#endif + val = numopensockets; + return (sysctl_handle_int(oidp, &val, 0, req)); +} +SYSCTL_PROC(_kern_ipc, OID_AUTO, numopensockets, + CTLTYPE_UINT | CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_VNET, 0, sizeof(u_int), + sysctl_numopensockets, "IU", "Number of open sockets"); /* * so_global_mtx protects so_gencnt, numopensockets, and the per-socket