From nobody Tue Oct 17 19:43:35 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 4S94Cq40bgz4xvP8; Tue, 17 Oct 2023 19:43:35 +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 4S94Cq2Py1z3L6j; Tue, 17 Oct 2023 19:43:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697571815; 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=qVTA1obK55yD6G56XzFJKSP1q3GQA1cCrt2uWpS/BO8=; b=ZcYY0veiSLKXmT/uj2cAQyF8dR+tWBgYqZn6vLvBIii3PZpnQOw+PHZljoW0UVF5XQV9iP wHev2OFWGeVSFmv0TJCwKRIJcjgU6sv7MN9uBj5VmdG/tOfn1QPEuJ/j+Xfa5XQtoHZrFi qeQPR0NW28+ltDsQST8C1JBG2qR6cqx3EhvnLLLC1RInQjiGv+Azk/xt/fkPDzbiQUIvZS 1K/069x/UnoTkh0la7P6vclMIfQw5vKFXNuY3yvEksDWyVNAIwXzKFMRvAqjzs0igYX6Ge GNoYwrBvlPl5FoKKMPrwDuPABeMVpB1iG8XzzctaL4Rk4cYH8jan047Qo4KUyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697571815; a=rsa-sha256; cv=none; b=p229QbNZLTRamYYbXWUfDIjNg1F1GS43K/I4txYXXyTIxUaeFW3/HcXfabWRdyoHZ6rf+W 5qnybgnFjsbLr3qmErG+eT4KglE/tZovwrZCoOblGSnUm5QKGIaN6DuLxx+N7YtTrab/J+ OoKgFn7cvgUmNIoI/MIBqssHVEmPq9jpPq36nXNb4m0SrDv8PyQJ6XmfuFJ5Cqw6rD5EwU xkdETHDtBCJGq06nhxDpDrWxwL65arw94XxtBcxhe+f4fQXBGMh/0IUGG28ufoWDsddjUC ntymlJNTzgNaj/xaVelwi/PjHhan6QNEcnrLX7q0+SkaFgxTEdKHf7ihOWAMQQ== 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=1697571815; 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=qVTA1obK55yD6G56XzFJKSP1q3GQA1cCrt2uWpS/BO8=; b=reKFACeHsrdpFgqERaq4+ds5kRvNUoQWUGLN2uL0IWrjj+s2Ot8kOABkn1UKkNXdfyh7gW cn/0ljXMH2vXsUtZjqff8DaztjaIMTP6ko7p+BeZGU5zYNn2p1FfoooHZr/QVUcCBlMaBe DIbtUPdS5AqQxcZ7xh86QRCIDS7QE/VL/f/TfoFuegO5zL4bWwA/Z/KDUDVaB993048OUo jTd5G7L1ajtIco7/TQewJHBZsgRsygcyss+qDA2luiDSP+z8OWvQan/cG0DxGlFpACDeYw slqTdKM82jDRCbmmQ+VsrWIxekfZR+/3rS+9ld0ssec3Djl2cd7jEg+3QpgQ6w== 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 4S94Cq1TNGzd4J; Tue, 17 Oct 2023 19:43:35 +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 39HJhZ8i013258; Tue, 17 Oct 2023 19:43:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39HJhZkW013255; Tue, 17 Oct 2023 19:43:35 GMT (envelope-from git) Date: Tue, 17 Oct 2023 19:43:35 GMT Message-Id: <202310171943.39HJhZkW013255@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: fea4e20afb76 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: fea4e20afb76b900bfc6a733487470e3ec6f13a2 Auto-Submitted: auto-generated The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=fea4e20afb76b900bfc6a733487470e3ec6f13a2 commit fea4e20afb76b900bfc6a733487470e3ec6f13a2 Author: Olivier Certner AuthorDate: 2023-08-17 23:54:43 +0000 Commit: Mitchell Horne CommitDate: 2023-10-17 19:42:58 +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 (cherry picked from commit 2ede38aff5d4c91a17ab6d093f2e8cce24b5418b) --- 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