From nobody Thu Dec 21 13:43:33 2023 X-Original-To: dev-commits-src-branches@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 4Sws8P3m3bz54pXB; Thu, 21 Dec 2023 13:43:33 +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 4Sws8P1k9Qz4NVR; Thu, 21 Dec 2023 13:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703166213; 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=hCnnz/f5QJ7lS98xqgnUATgagHm/bUrO7dseLaM0qE4=; b=lw/nRM4DNAxCrQ9/p1DQ1rrtGt58OP8tCXqAtNFwcwIIL8pUh7QcS2wxb3CaFdddwdfTkm vdc1kzYgcNGF5p49CvvNeJgejv/wlk+ABuiJ+6IyrLkuYwALRyeSUG4AhCBFvWzAuhd+zk itcRO6w8XhSbUMMg55fjA0SjG3EqcpJyBrrEavgaVAlSIvddKeDTG4FqavQ6hARI+yRqbt Wio4Uwu//lNNO+e1RehcA28DT61ATyamGNHFhl8rGKasIDN/JynL9Vy7P5m0aYarKcTzAC G+6ASeXmJF3DmL7nSD9OrRVJv5W4cYVbPDk3LmcKAHKGvwVccB9d66GpqnDynw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703166213; a=rsa-sha256; cv=none; b=F2qM50BKFM/VhkvzcN+pQNo47XPbT3rztP2aRCVsM8tXogv2kfJPhBxqXQcRKs9mc16jQA cLvN2SXZXdzrh7O+DbR19H+TXBp558oDwT90HGSkjMBUZEM0Ig1127IYM+RUMzimGxSaIL l6L+/kVDkWEv0pLm3LfEb3APfK2NTn0uDGSJhPLnXMuuac6UHXwQv3O/pITuNpnJlG+2h4 VjUyTHT5G3IV0e4UhPXsds7w3W3CMb7095e/Qa2CfDJHhP9vFw6RqSDqc42P1lNzDpPhts HMcf2BjZL33I9fulPbhB9x5cb5hzYLubB0eVl4PbR+2Yh3OQ9/+avxiIFaHHaQ== 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=1703166213; 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=hCnnz/f5QJ7lS98xqgnUATgagHm/bUrO7dseLaM0qE4=; b=OrG7QTsAXySZ2Anwo5rr3b//mN/GzmAnXTz7bYNHdChXiYgyHFFp8XkRzUmGaCJF8V13Zo vUQmLxWZRqHO668iHqXPj3BvWhylwbq0tCbBT/F7e/EK1El5+eqPD5O1Kx312t0bb67/CT GT6k9Qs/wPvdjuFWYvk9NeaCeKWPytgt27z82ViRnKGQbJ925LSWb2i1MTrAszGeDaZbg7 8yh+c4a1N+7DaVdFTeusuEL5t8H6M1autv2yBYmsJJv370CYtJwouGVak3x7jxGOubuqd+ vbEwJ+OcgxOCjwg+XAE8LGWmHuH/zX7luuYGc7K5KwqqiD4YabVakxU57cUMsA== 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 4Sws8P0pgkzZmK; Thu, 21 Dec 2023 13:43:33 +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 3BLDhXXl078993; Thu, 21 Dec 2023 13:43:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BLDhXuV078990; Thu, 21 Dec 2023 13:43:33 GMT (envelope-from git) Date: Thu, 21 Dec 2023 13:43:33 GMT Message-Id: <202312211343.3BLDhXuV078990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 6eecda225f11 - stable/13 - cr_cansee(9): cr_bsd_visible() impacts, simplifications List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6eecda225f11f1e139976b08c439bbf357f1553a Auto-Submitted: auto-generated The branch stable/13 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=6eecda225f11f1e139976b08c439bbf357f1553a commit 6eecda225f11f1e139976b08c439bbf357f1553a Author: Olivier Certner AuthorDate: 2023-08-17 23:54:42 +0000 Commit: Olivier Certner CommitDate: 2023-12-21 13:37:08 +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 Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40636 (cherry picked from commit 82f9bc9ea8ed660c61050ad1d92f1a64108c7004) Approved by: markj (mentor) --- 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