From nobody Sat Jan 29 01:11:13 2022 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 EB83519908DC; Sat, 29 Jan 2022 01:11:13 +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 4Jlx9F4NY6z4kTh; Sat, 29 Jan 2022 01:11:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643418673; 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=i4dcRkPjQQ9BruhgOy85f5Bgc7iQpi0/jvIIpCecbok=; b=JbkUlrsvv8OZkN/xzi3drncUU7CXKc3VtUaRNTJIYtx64Fl8NXBkH2fBh30ILjKl8igVPn 5P6yBYLyw061jqYHyb6uzSEe2xfluWSqtvYC4ByPByqV9VJAzVyBH8XMiECj7Xr7+zd4b8 +1+WZvRfiSAr3cFDU/M9m/yMBZBDP9UEY4Xo5haUUuIp0wJz8msaHdSfAx2aNC3DfICOml CqqaJMLwg/o3Sy/+j8tVGC7tM4dESyWKmxsHfqCmZE12+/NYuwRj+vWsSBnIK8iD6Idzef X7IRxbrW4pnAUJJHx+zVxc2Dpp/FcejTHVwc348S4nHnCj+fdThPZb64pv+Ovw== 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 35DD147E0; Sat, 29 Jan 2022 01:11:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20T1BDYm039421; Sat, 29 Jan 2022 01:11:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20T1BDfM039420; Sat, 29 Jan 2022 01:11:13 GMT (envelope-from git) Date: Sat, 29 Jan 2022 01:11:13 GMT Message-Id: <202201290111.20T1BDfM039420@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 704d2103c613 - stable/13 - p_candebug(), p_cansee(): always allow for curproc 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 704d2103c61363e46e9f4a61b1e61527e5bfe173 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643418673; 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=i4dcRkPjQQ9BruhgOy85f5Bgc7iQpi0/jvIIpCecbok=; b=ieVlAIwx/jI6IoRc55OAufI9SktR2BBnu2JIRS6xXeYZ4mxrEng6AadLQakQTGko4XJnzi 0oLjkl18olussxtkvAEuNwqKkZuR3RiC68YTBi4gEDkK9M1feHlTKZL1wtccfK/tM5/kMu LKdlMBwfZQdlVrpSslcYIZ/e6PpBwxZ5iRifVW7NoOSnoAE2/RLR8NwHzQteO1AOKjCTXG EW2vLmusdAdeeMn6x8kWOxhobsOmT5X3MOWo1nNcLEHMVUD9Gqeq66Y/MwbSohKQsBVGHI y/ApW6Je6gq1laoGNKS3DZg0273m2cMsPEneDMhdck3+yLo/W+Wf6ksTG3Sacw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643418673; a=rsa-sha256; cv=none; b=Ps/8GZgxW6rWO3PhQVWbzrW7ghHpccjbrUho+O/F2PmYDDXT10YdW2XjQn8rpl1hKLCfFV NQ67td8oeZ4CBVtajrB4C0TV4SqGKqcksF+fbIlPwXczexS1yBMdyYSASvf6/lB4XcOB4D qtF/elMEiG+1HQmzX82vSa52gmWzhWV8JF0fXiX6aM6FzF+GKN5sBgKxRxCLPZHY6j3zvd jKnvMYh9FUxaBYPznJ+z6VQM6iOTvk4gPezgXwi+ZRK1FeWyq/f6LaZjhijj3Ql/3PE957 WEPihbmU07HZnZ1ZQ64/Tm9Y+QO80AV0pOzS7hFbFtrquZaT4lMzXwrdbbw2NA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=704d2103c61363e46e9f4a61b1e61527e5bfe173 commit 704d2103c61363e46e9f4a61b1e61527e5bfe173 Author: Konstantin Belousov AuthorDate: 2022-01-21 15:29:17 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-29 01:10:44 +0000 p_candebug(), p_cansee(): always allow for curproc (cherry picked from commit 55a0aa21628ad7b3bd8d6a42e51d79867d8996a9) --- sys/kern/kern_prot.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 08fc3c8062db..484ebed95118 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1460,10 +1460,12 @@ cr_cansee(struct ucred *u1, struct ucred *u2) int p_cansee(struct thread *td, struct proc *p) { - /* Wrap cr_cansee() for all functionality. */ KASSERT(td == curthread, ("%s: td not curthread", __func__)); PROC_LOCK_ASSERT(p, MA_OWNED); + + if (td->td_proc == p) + return (0); return (cr_cansee(td->td_ucred, p->p_ucred)); } @@ -1681,10 +1683,10 @@ p_candebug(struct thread *td, struct proc *p) KASSERT(td == curthread, ("%s: td not curthread", __func__)); PROC_LOCK_ASSERT(p, MA_OWNED); - if ((error = priv_check(td, PRIV_DEBUG_UNPRIV))) - return (error); if (td->td_proc == p) return (0); + if ((error = priv_check(td, PRIV_DEBUG_UNPRIV))) + return (error); if ((error = prison_check(td->td_ucred, p->p_ucred))) return (error); #ifdef MAC