From nobody Thu Sep 28 15:10:44 2023 X-Original-To: dev-commits-src-main@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 4RxH3m5BzQz4tts4; Thu, 28 Sep 2023 15:10:44 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RxH3m4Rp3z3YBF; Thu, 28 Sep 2023 15:10:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695913844; 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=nMbqgc9PkQuFVmCO1f7k89B+9QWg1ExSNPo5jm8AOyo=; b=SkvsEodDaGbXFpr0ZQ+WLbMhSuomAgW7dSv5D2u5HDR8T7TfJzoxRFzI0rA0BCCpMWsSjM lASgHdfr9cZPeHLI2bXS8yviXp89KSdOpb2xPrqh8czOsXggNfyF4n0VaRN8o69eq9E48w 9+yeKuy7N0TV8xFIplUV67Hhc2tlzNRjzE/7d3nir3gIKg4lq0Ep//3v16KKmS9z2Kjw8D 4TiemHIFo8kvBj8pfbHS8yJd3C7H/m5DavexhYTlgrrug24rvaQUc3jmmKSL7qTdiurSQZ 67w7U6ZY8TkmhuJYaMINXH5DWvrDrWEEemv38EeLBj6tf5v6LwFVRjeFU7fJxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695913844; a=rsa-sha256; cv=none; b=kyDswCrH5jvkN12qkbHJHJ8jfPVkSAkLwOeyB3fLrPXaE0CeNjcABzb/Sfn2Enzqfji4tl pLS716mBA/wS6lvrSBLAYQqpm1weeL1prZ+f1Ws3c4fQA68Jw4Szpg3jxVG5tCpL1gD88n v4BQgUgrw/JGG60wRC+src4m9q84+gw0i20dAR8sBXxvVKfhg2AA9YIjtjh1gbSY/F6Byo KW2jBOVuQkUzsyWn17m8g3Sa0YnWbRKLwCcEVoZo7CViVjOiqGz1j524fn4OgNeFig2caA ivcdCFyDKz3+7hHYemCSASgbPPZzdVWwfdVVZQiBlfaJHuNNS4iBNS2gAGRdgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695913844; 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=nMbqgc9PkQuFVmCO1f7k89B+9QWg1ExSNPo5jm8AOyo=; b=p62nObPz6aL8uWS2vnYfbhuNmfs2K8Ark9n5CIGpTI3rw5DQttCb7axrUMqY98Dh5kM1I7 /Nn4NTQ97RvhjHISPKNzTVZ8NnaPEKzJvdFKQEN3384CZ/RCrc9Q7IkAWTTSzzaVfQL076 mMRHkNLnbAT3EVqPc85Q0cUFu6RvZSaCuYjoVuORWJwFpUrsoeDd92x6q/2r++Cj1K4rkn UizzfCXXxHgEHvz7Pbq02Qmlf0wtErkSRymS8Ygt4GiS6NmAZiXYRSOjhQwV/Shc6+axLw 91cZG+hBs8ADRVKFDYeN6kOsqpS1cpcM/FY7yVgQNTszdf/Xqlo8pMEONtRz1Q== 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 4RxH3m3Y4PzC4m; Thu, 28 Sep 2023 15:10:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38SFAiiC047559; Thu, 28 Sep 2023 15:10:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38SFAi5E047556; Thu, 28 Sep 2023 15:10:44 GMT (envelope-from git) Date: Thu, 28 Sep 2023 15:10:44 GMT Message-Id: <202309281510.38SFAi5E047556@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 82f9bc9ea8ed - main - cr_cansee(9): cr_bsd_visible() impacts, simplifications List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82f9bc9ea8ed660c61050ad1d92f1a64108c7004 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=82f9bc9ea8ed660c61050ad1d92f1a64108c7004 commit 82f9bc9ea8ed660c61050ad1d92f1a64108c7004 Author: Olivier Certner AuthorDate: 2023-08-17 23:54:42 +0000 Commit: Mitchell Horne CommitDate: 2023-09-28 15:05:46 +0000 cr_cansee(9): cr_bsd_visible() impacts, simplifications Remove references to cr_canseeothergids(9) and cr_canseeotheruids(9). Defer to cr_bsd_visible() for controlling sysctl(8) variables. Reviewed by: bcr, mhorne MFC after: 2 weeks Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40636 --- share/man/man9/cr_cansee.9 | 61 ++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/share/man/man9/cr_cansee.9 b/share/man/man9/cr_cansee.9 index 4824a231170b..d5cdfdd6f8e5 100644 --- a/share/man/man9/cr_cansee.9 +++ b/share/man/man9/cr_cansee.9 @@ -1,5 +1,6 @@ .\" .\" Copyright (c) 2006 Ceri Davies +.\" Copyright (c) 2023 Olivier Certner .\" .\" All rights reserved. .\" @@ -23,43 +24,39 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 19, 2006 +.Dd August 18, 2023 .Dt CR_CANSEE 9 .Os .Sh NAME .Nm cr_cansee .Nd "determine visibility of objects given their user credentials" .Sh SYNOPSIS -.In sys/param.h -.In sys/systm.h -.In sys/ucred.h +.In sys/proc.h .Ft int .Fn cr_cansee "struct ucred *u1" "struct ucred *u2" .Sh DESCRIPTION -This function determines the visibility of objects in the -kernel based on the real user IDs and group IDs in the credentials +This function determines if a subject with credential .Fa u1 -and -.Fa u2 -associated with them. +can see a subject or object associated to credential +.Fa u2 . .Pp -The visibility of objects is influenced by the +Specific types of subjects may need to submit to additional or different +restrictions. +As an example, for processes, see +.Xr p_cansee 9 , +which calls this function. +.Pp +The implementation relies on +.Xr cr_bsd_visible 9 +and consequently the .Xr sysctl 8 -variables -.Va security.bsd.see_other_gids -and -.Va security.bsd.see_other_uids , -as per the description in -.Xr cr_canseeothergids 9 -and -.Xr cr_canseeotheruids 9 -respectively. +variables referenced in its manual page influence the result. .Sh RETURN VALUES -This function returns zero if the object with credential +This function returns zero if the subject with credential .Fa u1 can .Dq see -the object with credential +the subject or object with credential .Fa u2 , or .Er ESRCH @@ -67,24 +64,20 @@ otherwise. .Sh ERRORS .Bl -tag -width Er .It Bq Er ESRCH -The object with credential -.Fa u1 -cannot -.Dq see -the object with credential -.Fa u2 . -.It Bq Er ESRCH -The object with credential +The subject with credential .Fa u1 -has been jailed and the object with credential +has been jailed and the subject or object with credential .Fa u2 -does not belong to the same jail as -.Fa u1 . +does not belong to the same jail or one of its sub-jails, as determined by +.Xr prison_check 9 . .It Bq Er ESRCH The MAC subsystem denied visibility. +.It Bq Er ESRCH +.Xr cr_bsd_visible 9 +denied visibility according to the BSD security policies in force. .El .Sh SEE ALSO -.Xr cr_canseeothergids 9 , -.Xr cr_canseeotheruids 9 , +.Xr prison_check 9 , .Xr mac 9 , +.Xr cr_bsd_visible 9 , .Xr p_cansee 9