From nobody Wed Oct 18 18:03:50 2023 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 4S9dyG4nRXz4xLBk; Wed, 18 Oct 2023 18:03:50 +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 4S9dyG4B8fz4XZs; Wed, 18 Oct 2023 18:03:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697652230; 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=R1BcFiZ+sPfTPiDVV+5EXG1eSGov00fwNbe92wuQbNU=; b=Kjm77lOc3rLl13QkB8XGz72vwxkPAViFjJkGVN3ofMMsW7YShH+SGnyayJ/zeu5VfH8J60 muj0cNDOmSPKRSdaI3BJ7wMEvokLZRKy45xRfhmJ8cvL5dqgN3Ib2d0Tyclw8ISO5CF7zD UBE4KKKbE717ILBaQFN2dt6dU9ClVPO3avUXJxVGl27oX8omczVUew50k/K4LJlpv9rSK6 fOz6dLf9IfpfHg6TRNVE8ET8EeTEve85jQJmI+Ta+/Ltk9VGdTne0bRRQNPguHwIE4mF9a yEhhjsq695vS5DeEQxmnm8yYEfCtgvq1+/qFJ7EcYs9gQ2Dy9fdvsU/0EiOlrg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697652230; a=rsa-sha256; cv=none; b=KPqXBCbs8ks1ICd6FmkTcKjSU0gjOBvY/31QB3t4JP6FKvaoHxqkTpekruqOBJMJGuxKmm Newi8xJx6/aFCo0yA18qoUxNExOsr+udtj5sfSWkN2p7Uxw6VOthsfXJA+WUf5GNyln/g3 YuV6Z2DFBPx21jWRVDMoZWZx+DmH7gsrDeHo7c/KPF27CWZg8jDmXLIBlLvb3RPgTCqOTK Nm6+VfnlMBK6yayoH93Co58zvBBakuekMR6Idq0iLvA6qnKXbp5KUio2qnlf8fWLMc7jxH 03XCuQfGFtO36rTST+m3bVCpYKhE1Mg1EvSOA5ruh1mfnXZgd9dYeauOGrkIlg== 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=1697652230; 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=R1BcFiZ+sPfTPiDVV+5EXG1eSGov00fwNbe92wuQbNU=; b=BTSN0uwn/ONjbOgqtJcjQk7yPqJ3UOkZyyS4saCI/mmVhr4q6+5l8txbJeBIm4TeNWr62/ 231l0B9bNhWSr3ylYSLPD+C2NYDp9F9IsbXgX95WlaV01XcsUYg+m29pf9wuWnfXRhI5dF nJEZi7BRHIwFoQpgV0tLKNKCRNw5pfgYKTvqLRR1TZFFS4glYi1r/a/f0Ib4yztMXjunfO I/v/JFu4mwcCzibyG0dK/V82WCSA4O7Bwm4OLmBl3HYt6Kx/LFKyMuG39GjXyGZbFQLooz ePNMldUYcKiS23ya7pxFccHTGUbbCGdKJr67D/gjk+QWTTsfU8YUJ5xUeo15eQ== 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 4S9dyG3875z2L1; Wed, 18 Oct 2023 18:03:50 +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 39II3o0v044733; Wed, 18 Oct 2023 18:03:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39II3oiW044730; Wed, 18 Oct 2023 18:03:50 GMT (envelope-from git) Date: Wed, 18 Oct 2023 18:03:50 GMT Message-Id: <202310181803.39II3oiW044730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: f7cee2431fb2 - releng/14.0 - cr_cansee(9): cr_bsd_visible() impacts, simplifications 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/releng/14.0 X-Git-Reftype: branch X-Git-Commit: f7cee2431fb2c195250cfedc9f4efaca07afd223 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=f7cee2431fb2c195250cfedc9f4efaca07afd223 commit f7cee2431fb2c195250cfedc9f4efaca07afd223 Author: Olivier Certner AuthorDate: 2023-08-17 23:54:42 +0000 Commit: Mitchell Horne CommitDate: 2023-10-18 18:01:16 +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. Approved by: re (gjb) Reviewed by: bcr, mhorne Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40636 (cherry picked from commit 82f9bc9ea8ed660c61050ad1d92f1a64108c7004) (cherry picked from commit 0d8de5b2dd61ad550afa86688e61cf546507dca6) --- 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