From nobody Tue Oct 17 19:43:33 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 4S94Cp2vKcz4xvV2; Tue, 17 Oct 2023 19:43:34 +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 4S94Cp1rdsz3KnJ; Tue, 17 Oct 2023 19:43:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697571814; 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=JThUSMSr/Nx07aTgvT4lrT5HmM1h/oSegl72tma4D50=; b=PrRHdxXlwoOIkuPA4RYK0qctueYjWWrXp2zEpiRnQT2leUFtj6+2O3cjzMnKMz4ei+mwb0 U2yBdC9Oqa9k51KUAh/nzZZ3SU+nZnXdbUc1uT28KtMid0LRSY46cyqfNg6bWvrZN43czj qt+ThNTfgMcmeulaDalzW0pf51l+/+NLImCarEZyTwcDGDdX7XzwLnWGrp4LT8vEmrkKWz 3Gvr4bCGQul4mjvT5tNbYLM9xXkCUYPMO9XqJ+eCWlwekNHU5zKQbjsHOiel2ovs5mg5An tF9T++b1ZsJ43vNRdB4hNfMxFypYCovEq8I2R7RE3+4+qNF0puM90xPfaDxWFw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697571814; a=rsa-sha256; cv=none; b=HO1OQR+ElmbIgORyNL4he8mrppK+UZo5oRNL8TW+nmgbNJ7ofRmR/UMmEQUeSg0YzGSggK dmepjebFsNUJQsJU0bEdm5/Jk2FAtjUlnIOUWqRj7UFziA6ZAvtDpzC8KHUwYgU8XflubQ wUrQAbf83LYOWGa/tAiBR849eizJEhqXddqWRa7npZf+/0RbIkv/zvlFjjupTas2OVlAWS PJ9os044DRNnvCUiF36UzO0nB//lk2I7uVNN16yJJjdsSJo/GkC/ku3fBie/I6/b76qzkq bSv8B732+2oO1rKaRmcaAPZu7DYwImdz4KV8UzQIOOERJuRgByJEasLCpRWFGQ== 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=1697571814; 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=JThUSMSr/Nx07aTgvT4lrT5HmM1h/oSegl72tma4D50=; b=HJ2oHgTXtbrX3eP0d/borQZZ0Lkht9WPJIGm3dIOslGywDHQCBVHPrzoXUdDh90TLbvBQo AS8bDeo04PY+rxgTyuqxiChtX37/uvq3esGc0qYXCA58Tvv3XfBwvMJHKExYICi70CZYDY Q444BnwrD5iHTPQmbtmUi5BzgpFNNy27YqQHXGs037ig3tbVXeo397n7GPpB/tAgoB3ebK aaE4YlHjKBUOzllZIaO97j6FeHNm6udc4O7FYd2B34WT/FkIy0oH9dIo/PJqu/wyDJ1gXF RPnocKfvtV7i9DVIi62Zyhi/99HouTggBIn4jtUjzHduPjT017L4bAHEgDTekg== 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 4S94Cp0gYvzcnj; Tue, 17 Oct 2023 19:43:34 +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 39HJhXXs013215; Tue, 17 Oct 2023 19:43:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39HJhXs6013212; Tue, 17 Oct 2023 19:43:33 GMT (envelope-from git) Date: Tue, 17 Oct 2023 19:43:33 GMT Message-Id: <202310171943.39HJhXs6013212@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: 2ecbfdaecbd0 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 2ecbfdaecbd009d32b2453c7b2bd6c33656b92ef Auto-Submitted: auto-generated The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=2ecbfdaecbd009d32b2453c7b2bd6c33656b92ef commit 2ecbfdaecbd009d32b2453c7b2bd6c33656b92ef Author: Olivier Certner AuthorDate: 2023-08-17 23:54:42 +0000 Commit: Mitchell Horne CommitDate: 2023-10-17 19:42:58 +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 (cherry picked from commit 82f9bc9ea8ed660c61050ad1d92f1a64108c7004) --- 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