From nobody Fri Jan 17 19:42:10 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 4YZVVp65Xsz5lMpQ; Fri, 17 Jan 2025 19:42:10 +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 4YZVVp5Qdcz3xXc; Fri, 17 Jan 2025 19:42:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737142930; 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=3wuHRgx/J9wKhPYoRqj7tdXebFT2RWgXgwTO5rge4nE=; b=jSnx3I05I47mzIQr35bDxtHBN5wdiTD8okMmYLKhQk4bYdpQZOsLIGNB69NzY6cUgAZKBu bYoGjc+mPR79FGGdBhMqVG1gszSNRnWKF7G1bbzc3KHq7METWkXSf4qxKkvYJ1m+7jpXoA b42C0uv0iy6S/C9Ung/wneUJzr+b+HqlqgKxSiZwDhPENHYQAnPj361+UTF9buzVdZ8gIC k99z82c8m5taTEgusIoHGivvvhJ1OcabsrfyEbjHLgtPjH+Mwdhm7LDy+THeFwAufrk9IF 7UxBNEA+kyW6czNhx7FnWFCqza1esyfelJTawGeXce/xOqk3KsmCzlxVErmVnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737142930; 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=3wuHRgx/J9wKhPYoRqj7tdXebFT2RWgXgwTO5rge4nE=; b=innp3SMHFop4kC08RYj1S+J9vrtfAWyJDZlIIMk96jfZR2WxOwcmSwh1CHJXD8bNz00Mj/ YNV+0tDAhIxfMhgGGHV6/NhGkXfVJ6ax0yB3q5dBsLjj4hZtE7PLHsd3ttOeR8NqE8TjOb 1oGWn7Ri30Ubox9jbd0doX9ksHl8r94igtNCeQ29vVe0+++hITK4ROv092G7AdTUo58gmf 1kxxOytDYbr0TwcbIfKyNLMxYAB/WPYFEbINqS0RJhWhApHkoggKhQUifZfMmQLOsnt/cJ tzZLR8b/H/QIwSvywpJaEcashVzf0d3mhnEAARG5sSkut1/xMw0zh6ORBlg92Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737142930; a=rsa-sha256; cv=none; b=MlEs5chA/QvZzFxBj9v1kLuoUmzF12vqaYUwrvT8JMRMtrrfhwpYaMoJ7PC6k0HDgGuXKc JUZM0dPkfC3bf65eiQVtkpExyd8KJ3J4QOddICMcss+W4kE+tF5xFltu1y8JrNuXPrH8Lm oHVuKHu6W+/SR1AJIX1LBBYfcKar7WNzdXCAUdO0e3fYofqKTrjoNkHlmlWcZ/zIAIHq1p gxDDmUacVK7k9HimPaS0AA537fMQMzRa67xEyTKXiNlAedKqycBs2IzsTKTnLvADtU0jh5 hjed/yiYFi9nYjpnn+QtbGby8NQqJdevHQ4bIdetz0yqP+d3EB4HqMQTJvx9pw== 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 4YZVVp4lT0zXr4; Fri, 17 Jan 2025 19:42:10 +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 50HJgAki057150; Fri, 17 Jan 2025 19:42:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50HJgAso057147; Fri, 17 Jan 2025 19:42:10 GMT (envelope-from git) Date: Fri, 17 Jan 2025 19:42:10 GMT Message-Id: <202501171942.50HJgAso057147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Eugene Grosbein Subject: git: 08384f613cd8 - stable/13 - 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: eugen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 08384f613cd808e31fa3ae3dd86fa078b49d3f4b Auto-Submitted: auto-generated The branch stable/13 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=08384f613cd808e31fa3ae3dd86fa078b49d3f4b commit 08384f613cd808e31fa3ae3dd86fa078b49d3f4b Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:08:58 +0000 Commit: Eugene Grosbein CommitDate: 2025-01-17 19:41:51 +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 (cherry picked from commit 59498e099cc055da7afca8266087b7668be6d7cb) --- 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 81145ff1e1ac..24cb885504c9 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -246,9 +246,23 @@ SYSCTL_PROC(_kern_ipc, KIPC_SOMAXCONN, somaxconn, sizeof(int), sysctl_somaxconn, "I", "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"); /* * accept_mtx locks down per-socket fields relating to accept queues. See