From nobody Thu Sep 28 15:10:45 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 4RxH3n6PjSz4ttvm; Thu, 28 Sep 2023 15:10:45 +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 4RxH3n5p76z3Y41; Thu, 28 Sep 2023 15:10:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695913845; 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=wtfE3527S7k9dnQ5t7JWD6+mffgJWcNnuNWzlL1Nbes=; b=Qbf4JSaSvdoITe/PEwHRbau2MRXq+pWoME0zBUzuCTY3Ww4osHJD4GcecjM2fg1mM8tZi5 hszoWavuYtDy4Zs3FqgBzRCaGmniEvewAUqhXV0eyAcjPWTKzjrpF5EVhhoG3Ks95M3mZI kmH7S3Tf1sDBMyTaBaBGKMF2GP5sBtUKtUgLK2oIN8kgFnBUrpwMInXfVxFuBbl67v31jW Kf23x8pIUl18WF3LU3Zmheb8sBbcsYm+dLKgHCGIpZLUh9iuiM0vDZBTktQZa0DqhsY2IF CqfPUPiZxHE5PEHyKhkae8mQ9o5DIsNPC3sNe8oIIej6e1oCutWs+Yo0BbksNw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695913845; a=rsa-sha256; cv=none; b=T2VMzeamH2wegs2kYQQRD5mIIXvOPUtK+MJg9OTOjQiNRgkNnVu4EY+ZCVmNCptcy4i66s wrxCngdYrgHoKkobm3LJ3217SlsTPZDihQeuZWqv51gajPKMQ5FEOiaL4NsL2h2WIoVwRD kdin69/L27YNED5rAPQICNqxQkf2w4kIVYOaP5k9JZibpQPzL5hUf0rljKCiE4mJ9jByuZ SFR15m6lBMNm9cbEJNkfcjyeBa1GuPHksrN7GB4j3kkbDddKDgPw24OA2gLtOSwcz0W3I8 18J1LF18UgiGWwZUqFvivUZwfSyy5qioei2G9xWMI8ZkRNZIChRiNqxryoH79g== 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=1695913845; 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=wtfE3527S7k9dnQ5t7JWD6+mffgJWcNnuNWzlL1Nbes=; b=vyl5GogEC6f0jEezG6hj4qflvugAkMSKQuFpyj4AFqk7pvi56L87Xc/7vtOCAlLh674aum DZ9bWXlw+Viu7kPH22/ieCAbR8WFRr1utwMrBi5ZpeS+zSuhOxPoeP5TPtnvwC/2z4lZxq Q33EEZs7XZAcN1DJjIWhTOPUipu6dXLNrnVlQwjCEN6jk/Hyp8W761BV6UH4ON2TpIgz+I vhpl0h6/D3+mUi+SYaAZ0T1rAIXPxCLzMSUW48QlYKzm6/j7PdF6N3SFqAMLFBm3+g34Xj OAnpr/F9jCljSnmORppMCvaCmWr5aW60ijglwzI4uuotBrnzGZ0NWZxwdcdo3Q== 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 4RxH3n4Ws8zBjx; Thu, 28 Sep 2023 15:10:45 +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 38SFAj2W047605; Thu, 28 Sep 2023 15:10:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38SFAja9047602; Thu, 28 Sep 2023 15:10:45 GMT (envelope-from git) Date: Thu, 28 Sep 2023 15:10:45 GMT Message-Id: <202309281510.38SFAja9047602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 2ede38aff5d4 - main - p_cansee(9): Bring up-to-date, misc fixes 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/main X-Git-Reftype: branch X-Git-Commit: 2ede38aff5d4c91a17ab6d093f2e8cce24b5418b Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=2ede38aff5d4c91a17ab6d093f2e8cce24b5418b commit 2ede38aff5d4c91a17ab6d093f2e8cce24b5418b Author: Olivier Certner AuthorDate: 2023-08-17 23:54:43 +0000 Commit: Mitchell Horne CommitDate: 2023-09-28 15:05:46 +0000 p_cansee(9): Bring up-to-date, misc fixes Essentially defer to cr_cansee(9), except for the specifics. Be more specific on the return codes. Reviewed by: bcr, pauamma_gundo.com MFC after: 2 weeks Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40637 --- share/man/man9/p_cansee.9 | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/share/man/man9/p_cansee.9 b/share/man/man9/p_cansee.9 index 84287dac951b..9fdce460dfea 100644 --- a/share/man/man9/p_cansee.9 +++ b/share/man/man9/p_cansee.9 @@ -24,19 +24,18 @@ .\" (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 P_CANSEE 9 .Os .Sh NAME .Nm p_cansee .Nd determine visibility of a process .Sh SYNOPSIS -.In sys/param.h .In sys/proc.h .Ft int .Fn p_cansee "struct thread *td" "struct proc *p" .Sh DESCRIPTION -This function can be used to determine if a given process +This function determines if a given process .Fa p is visible to the thread .Fa td , @@ -45,13 +44,14 @@ where the notion of may be read as .Dq "awareness of existence" . .Pp -The function is implemented using -.Xr cr_cansee 9 , -and the dependencies on -.Xr sysctl 8 -variables documented in the -.Xr cr_cansee 9 -manual page apply. +This function explicitly allows a thread to always see its own process, +even with pending credentials changes +.Po +see +.Xr ucred 9 +.Pc . +Otherwise, it simply defers to +.Xr cr_cansee 9 . .Sh RETURN VALUES The .Fn p_cansee @@ -62,30 +62,18 @@ if the process denoted by .Fa p is visible by thread .Fa td , -or a non-zero error return value otherwise. +or ESRCH otherwise. .Sh ERRORS .Bl -tag -width Er .It Bq Er ESRCH -Process -.Fa p -is not visible to thread -.Fa td -as determined by -.Xr cr_cansee 9 . -.It Bq Er ESRCH Thread .Fa td -has been jailed and process +is not part of process .Fa p -does not belong to the same jail as -.Fa td . -.It Bq Er ESRCH -The MAC subsystem denied visibility. +and cannot see it as determined by +.Xr cr_cansee 9 . .El .Sh SEE ALSO -.Xr jail 2 , -.Xr sysctl 8 , +.Xr ucred 9 , .Xr cr_cansee 9 , -.Xr mac 9 , -.Xr p_candebug 9 , -.Xr prison_check 9 +.Xr p_candebug 9