From nobody Thu Dec 21 13:43:31 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 4Sws8N2tCzz54prM; Thu, 21 Dec 2023 13:43:32 +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 4Sws8N0b72z4NDh; Thu, 21 Dec 2023 13:43:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703166212; 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=fRccNxX7acYoZ4A1dpSRUj2EJZ1L/ZIodflb1PqCjWY=; b=alLw8MFWwRJfWNipo/25bnjICPzODaEp/w3Q0uiZNp/Y6UEcVtEmQPa0r6JF3Tdq41G73z 2IfPzDIjbfQwAubdBpIUH9ls6RrqjMXtGCYFhMs+WD4PPiYRGizRIH0tekQrm578k60yoQ otznqu0IbPTTibNTFLliymmLW+z9MzsRiXOO9k4RDvBJwCdRGgN1NXmP3LVmYTUlJkLg+O i4iy3pMk9IYlFIZWY+Go+Qkz/hMO4vlThixet/LaWxi0gKgu9y9n6sqPMoSDEUI7AoAIUE TGFNOnFb7CA2/CkxOhvvdEY6Zp5JbKyFF8/06DZw1XOtxYVroC2ScVN4amZoQg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703166212; a=rsa-sha256; cv=none; b=aZ7LYnx+VWjHY9zJeoMF9xCb9AO+kp2ZJ821pGYrQ7VHNad97ifNkQojHrIeIdaLUIABS4 xCWbKEkFhY47KLwpq0NbNqx9PdSfrT9JbCDVm79SE2/cs4GNbTHTfu2lFyCMkN62Q5Eh2/ TS3fKCZPKX1M1NRyI/bLxpdBSVlwA2UPl/5rFUF4/P4VPcr2tKwYFRZcRlE18kPASsrAjf 4iXHa18H2Psrt6apw7cyIQYxmmIUbbh+EbV7mpJQSaIbSm36b2NWCCZd8UB0x+dFJ+k751 QMBsVvxLbw6gRshHNq9WC/HNBNfgHsCg3K+6OvyvWrnTlR3Lx/QMXGg9g568yw== 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=1703166212; 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=fRccNxX7acYoZ4A1dpSRUj2EJZ1L/ZIodflb1PqCjWY=; b=XxSLdbU8iSl8UbBPkA68P+UTYHOWQzJLQsZrOzGRrpJFB1xVR8LmaGGUfXiTam4aBGjhRf zCVrK09Cn3w2Bx3al0x6QVB5rjUQm3QAkDvE9Gnl9ms2Z8sChUwxsLQu1Mp0WC83a+WoxZ J8EpDajRu+LsquJ2+CE+iUACIkSdd4vT+l9fTG9XyxI9YEtgzXacdyskBSK1azj0JDRO07 d2X74olNO+BzV7PWBxwVi5jciGDUsWfM1KIDg1wONmp9KGifxjV9T0m4cw+xpTqn/ngRJH TnPk5nlwr+F7OCLXXO5kr8K8I39G6PCtYPgDrN9fN7k4HJM7B3/ILNWogQpnUw== 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 4Sws8M6pcLzZtx; Thu, 21 Dec 2023 13:43:31 +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 3BLDhVOm078954; Thu, 21 Dec 2023 13:43:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BLDhVnD078951; Thu, 21 Dec 2023 13:43:31 GMT (envelope-from git) Date: Thu, 21 Dec 2023 13:43:31 GMT Message-Id: <202312211343.3BLDhVnD078951@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: 32a9108cdcc6 - stable/13 - cr_canseeotheruids(9): Revamp, mark as internal 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: 32a9108cdcc671547d087cf6eecbcdb37064b8ab Auto-Submitted: auto-generated The branch stable/13 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=32a9108cdcc671547d087cf6eecbcdb37064b8ab commit 32a9108cdcc671547d087cf6eecbcdb37064b8ab Author: Olivier Certner AuthorDate: 2023-08-17 23:54:42 +0000 Commit: Olivier Certner CommitDate: 2023-12-21 13:37:01 +0000 cr_canseeotheruids(9): Revamp, mark as internal Significantly clarify. Replace references to cr_canseeothergids(9) by ones to cr_bsd_visible(9). Reviewed by: bcr, mhorne Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40635 (cherry picked from commit 4ddd253b38dff8725555355cc1b5238b1bbfd380) Approved by: markj (mentor) --- share/man/man9/cr_canseeotheruids.9 | 73 ++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/share/man/man9/cr_canseeotheruids.9 b/share/man/man9/cr_canseeotheruids.9 index 80acc2d7a6ca..230c5ea59b78 100644 --- a/share/man/man9/cr_canseeotheruids.9 +++ b/share/man/man9/cr_canseeotheruids.9 @@ -1,5 +1,6 @@ .\" .\" Copyright (c) 2003 Joseph Koshy +.\" Copyright (c) 2023 Olivier Certner .\" .\" All rights reserved. .\" @@ -25,56 +26,54 @@ .\" (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_CANSEEOTHERUIDS 9 .Os .Sh NAME .Nm cr_canseeotheruids -.Nd determine visibility of objects given their user credentials +.Nd determine if subjects may see entities with differing user ID .Sh SYNOPSIS .Ft int .Fn cr_canseeotheruids "struct ucred *u1" "struct ucred *u2" .Sh DESCRIPTION -This function determines the visibility of objects in the -kernel based on the real user 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 the same real user ID. .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_uids . -If this variable is non-zero then all objects in the kernel -are visible to each other irrespective of their user IDs. -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 -.Fa u1 -and -.Fa u2 -have the same real user ID. -.Sh SYSCTL VARIABLES -.Bl -tag -width indent -.It Va security.bsd.see_other_uids -Must be non-zero if objects with unprivileged credentials are to be -able to see each other. -.El +.Va security.bsd.see_other_uids +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_canseeotheruids +function returns 0 if the policy is disabled, both credentials have the same +real user ID, 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_canseeothergids 9 , -.Xr p_candebug 9 +.Xr cr_bsd_visible 9 , +.Xr priv_check_cred 9