From nobody Wed Oct 18 18:03:49 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 4S9dyF3X3sz4xKm8; Wed, 18 Oct 2023 18:03:49 +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 4S9dyF2rGRz4XRZ; Wed, 18 Oct 2023 18:03:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697652229; 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=rDt1mUoydXI4DPEBjIHmzV3BYUwV6cDoie6XiGBSH+Q=; b=I4IswAgHBQNrECYmZ/srv6nSC07Ik41rCWcuIqvfM8ATT70sgZgWqtHAz2KwmUMBnI3Uds 598X8KZhMwKcNpLjC9K39Qe7N7JXmnlkGbEPAwOM+MSpd6q8jPS+rtIfyitQSL5fhogkVB DmVH2YT2/+UT4G042q3W9bCbFqOo3eaZrVX4cunaIGwE1wrPAhX0kCf99Jr/c8jphPfQL1 KImUZmGbV3snlc4yIWINsim5pDmKcmevh0KiE2vGsyqeUNlERo6dAdWDQrg1wAIy5SRdbS zNgMdqTSc8HNUkRbGvTiE6jyUn0ftAsV/UdFstQshwnbx1J1CvPHhYQLceFkgA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697652229; a=rsa-sha256; cv=none; b=oHRNeXj4I8lIw9p+QvkGI9X2pjZxrp4fqyzzvSWA6gGsfMvMQrci9PJ6hvoRz4seGPuncN 9cT+kNntdFiEATV+MroLKtXX4nXR+yCy3t8IGa/IV3HH+6+JaLNjkeEZAD96+8z5L/lyOh BN9kJ5/O/NrsX/uWqQ0Ubpw6pVyIvlHblGbDM95HLWP3OC5B337muIIIDC2C8dRBdme9xl zcKQ+7jAIYfkJdBzgfScrSybzDNVtp6e37iGyvterK8btwxdkO1NnVK8kXCHCzAoa+kDJV SR0DIxBYkSm6SdWo8WnKaUSLb2wOtdEdweMirPewI6g34/Pj2KvFQvjjaF4Deg== 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=1697652229; 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=rDt1mUoydXI4DPEBjIHmzV3BYUwV6cDoie6XiGBSH+Q=; b=VyNA4L6cruGvPuvkW+YStVXB8un/yhLkS0u+jY/8ny4z7q2oQ0tIK5I2WS9+MLM+RdNMmh AQ8gPXVFFDIBrGoaOT+OfrhZD8UfY1OoHiVibavsSab/q4jA6rajH9xVob6uH+4l42fFV0 UNNEJoOoL2hYKc8iRxqp3uEFZTLApNkqrKS+cN5gIChQAPrHyd7ollwroPPGrl+pwoB74S ZjN0KIbnc25SW4jLpeHukVDmAusHxeaLeUWj190smrf8/4U9sWw1MFqdyINmF6pu6ccdwG U8C/53+hau4YpBEvplu1YO2pggBFoHpn1fxL36rP+4KDjf5nRZ2QcixeuIyzLQ== 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 4S9dyF1xZ9z2Rw; Wed, 18 Oct 2023 18:03:49 +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 39II3nPc044684; Wed, 18 Oct 2023 18:03:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39II3nKO044681; Wed, 18 Oct 2023 18:03:49 GMT (envelope-from git) Date: Wed, 18 Oct 2023 18:03:49 GMT Message-Id: <202310181803.39II3nKO044681@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: e0180be23e62 - releng/14.0 - cr_canseeotheruids(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: e0180be23e62ee92bb15db22dc6bdc00886d8ecd Auto-Submitted: auto-generated The branch releng/14.0 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=e0180be23e62ee92bb15db22dc6bdc00886d8ecd commit e0180be23e62ee92bb15db22dc6bdc00886d8ecd Author: Olivier Certner AuthorDate: 2023-08-17 23:54:42 +0000 Commit: Mitchell Horne CommitDate: 2023-10-18 18:01:09 +0000 cr_canseeotheruids(9): Revamp, mark as internal Significantly clarify. Replace references to cr_canseeothergids(9) by ones to cr_bsd_visible(9). Approved by: re (gjb) Reviewed by: bcr, mhorne Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40635 (cherry picked from commit 4ddd253b38dff8725555355cc1b5238b1bbfd380) (cherry picked from commit d05ed9a37b84f277cbc06447b322930fe678b00e) --- 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