From nobody Wed Oct 18 18:03:46 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 4S9dyC52Qmz4xKhR; Wed, 18 Oct 2023 18:03:47 +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 4S9dyC1XDYz4XNJ; Wed, 18 Oct 2023 18:03:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697652227; 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=QDZFRZIVZbH2tBUn7To4WT5d3z4j/C33sOJ0tLsBfec=; b=eVX/H4wZ5A7Ew5gAKh1fi9ZEM3iK82amG/rzFLjdKpaTduCxUtgD+MgXu5/rwjyjbgNYqv /5g7Sz992FdJMgfKPnQlsRjIztWlurklVl2EEPm6l4QsXZ2IcPYJnTaxZy0GApZLOG4Yfy pm34fwrWADUXOBRjh9L/Eo05L2Uep0BBKOMgLlNBUYO9IwrPKex2Z2tm6651s05AUwiIuD NQm4bEK+JrgWx09H0as9C7fVJG9FNFfJSbYMFhCbi/GkYyyJ+pTJ1fVQ3xOrgNEDixNQNo 4RroMwj6KhWUeoTNHA1paJpbEZ1nZ706w/3zKG6GC3F2udkWhttiy3WlxtwYrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697652227; a=rsa-sha256; cv=none; b=yuZCRj4QgzKS8Id0sbgAKNQmE9utyi2BU+2ty1Nhn/6uZrAP5sHwqVpLvO2fF1k0+3NKZY JxgJg6VjTTAByIarSh+VkkDOP5q8Dx2R9ov9u1ILFk+pRm1I2pVhA329G9lm5fQXU2eF5o 5uEEK9E7cZHdBRq0Gy63l086x8Tz4BDmvvFQbEdnteeEwQZGNnczUM1idcJnR3vY/MJU9E 7cCzZ8kN2wrUXYsevcTL1NIjj37D08KGpH3G9A4SfkIuxFIoaWFaVSF/U0PsDJ7loBs+5o vOt1IgmzKaz8Upyqj87OzSQ85APM1465Dbvnt3xcEQcH850ouCwt8/xEcn6SwA== 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=1697652227; 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=QDZFRZIVZbH2tBUn7To4WT5d3z4j/C33sOJ0tLsBfec=; b=XqCJgMNKzhTz2gpq9HSeiDNryUHA99HqmOiMACzqhPJPcEbbWXOlsKEhminzqiv9UoLfvn 0UqLlpdTeSCgUqYG17zxZRS2E1Mk+ejDsE/mFQ7hEEFRA1jnh1rg8LeGnLnboaHtG0JnTD DnA1EX2x24rWOkWsdV7dZXAeOVJMpHpXqp9oxheZiJVMo1u83jrNlSSk26VvO7Mq8ETt2e d+sBvSuj37WsereJkL2K9D1mhZARH5AhQqVQzvmzeC8c4ZBvfR8Xji/K66JaFe9/TD1gvl /2LXecKfjGIArNj3OK+W80qJqu2QPxO22+xT8Sbso0kLr5qms56iPaFmnoU+qw== 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 4S9dyC0c38z24n; Wed, 18 Oct 2023 18:03:47 +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 39II3kAb044588; Wed, 18 Oct 2023 18:03:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39II3kxE044585; Wed, 18 Oct 2023 18:03:46 GMT (envelope-from git) Date: Wed, 18 Oct 2023 18:03:46 GMT Message-Id: <202310181803.39II3kxE044585@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: b6b628ed96b3 - releng/14.0 - cr_canseeothergids(9): Revamp, mark as internal 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: b6b628ed96b3e829cff0cedc77f16e9277a99a96 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b6b628ed96b3e829cff0cedc77f16e9277a99a96 commit b6b628ed96b3e829cff0cedc77f16e9277a99a96 Author: Olivier Certner AuthorDate: 2023-08-17 23:54:41 +0000 Commit: Mitchell Horne CommitDate: 2023-10-18 18:00:19 +0000 cr_canseeothergids(9): Revamp, mark as internal Significantly clarify. Replace references to cr_canseeotheruids(9) by ones to cr_bsd_visible(9). Approved by: re (gjb) Reviewed by: pauamma_gundo.com, mhorne Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40633 (cherry picked from commit 3fe9ea4d2d04d48a249b2e6161d416bb4d5b364e) (cherry picked from commit 15d2ead9623dc2b0a560fc0fd6ba89ca16715597) --- share/man/man9/cr_canseeothergids.9 | 77 +++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/share/man/man9/cr_canseeothergids.9 b/share/man/man9/cr_canseeothergids.9 index 79269533ae5c..f0c1e5c4e726 100644 --- a/share/man/man9/cr_canseeothergids.9 +++ b/share/man/man9/cr_canseeothergids.9 @@ -1,5 +1,6 @@ .\" .\" Copyright (c) 2003 Joseph Koshy +.\" Copyright (c) 2023 Olivier Certner .\" .\" All rights reserved. .\" @@ -25,56 +26,58 @@ .\" (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 11, 2003 +.Dd August 18, 2023 .Dt CR_CANSEEOTHERGIDS 9 .Os .Sh NAME .Nm cr_canseeothergids -.Nd determine visibility of objects given their group memberships +.Nd determine if subjects may see entities in a disjoint group set .Sh SYNOPSIS .Ft int .Fn cr_canseeothergids "struct ucred *u1" "struct ucred *u2" .Sh DESCRIPTION -This function determines the visibility of objects in the -kernel based on the group IDs in the credentials +.Bf -emphasis +This function is internal. +Its functionality is integrated into the function +.Xr cr_bsd_visible 9 , +which should be called instead. +.Ef +.Pp +This function checks if a subject associated to credentials .Fa u1 -and +is denied seeing a subject or object associated to credentials .Fa u2 -associated with them. +by a policy that requires both credentials to have at least one group in common. +For this determination, the effective and supplementary group IDs are used, but +not the real group IDs, as per +.Xr groupmember 9 . .Pp -The visibility of objects is influenced by the +This policy is active if and only if the .Xr sysctl 8 variable -.Va security.bsd.see_other_gids . -If this variable is non-zero then all objects in the kernel -are visible to each other irrespective of their group membership. -If this variable is zero then the object with credentials -.Fa u2 -is visible to the object with credentials -.Fa u1 -if either -.Fa u1 -is the super-user credential, or if at least one of -.Fa u1 Ns 's -group IDs is present in -.Fa u2 Ns 's -group set. -.Sh SYSCTL VARIABLES -.Bl -tag -width indent -.It Va security.bsd.see_other_gids -Must be non-zero if objects with unprivileged credentials are to be -able to see each other. -.El +.Va security.bsd.see_other_gids +is set to zero. +.Pp +As usual, the superuser (effective user ID 0) is exempt from this policy +provided that the +.Xr sysctl 8 +variable +.Va security.bsd.suser_enabled +is non-zero and no active MAC policy explicitly denies the exemption +.Po +see +.Xr priv_check_cred 9 +.Pc . .Sh RETURN VALUES -This function returns zero if the object with credential +The +.Fn cr_canseeothergids +function returns 0 if the policy is disabled, the credentials share at least one +common group, or if .Fa u1 -can -.Dq see -the object with credential -.Fa u2 , -or -.Er ESRCH -otherwise. +has privilege exempting it from the policy. +Otherwise, it returns +.Er ESRCH . .Sh SEE ALSO -.Xr cr_canseeotheruids 9 , -.Xr p_candebug 9 +.Xr cr_bsd_visible 9 , +.Xr groupmember 9 , +.Xr priv_check_cred 9