From owner-dev-commits-src-main@freebsd.org Mon May 3 16:20:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C2E76369B3; Mon, 3 May 2021 16:20:42 +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 4FYp9k2Ydzz3D7S; Mon, 3 May 2021 16:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1683C20FDE; Mon, 3 May 2021 16:20:42 +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 143GKfhY022286; Mon, 3 May 2021 16:20:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 143GKfWb022285; Mon, 3 May 2021 16:20:41 GMT (envelope-from git) Date: Mon, 3 May 2021 16:20:41 GMT Message-Id: <202105031620.143GKfWb022285@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2bd0506c8d94 - main - kern_ptrace: change type of proctree_locked to bool 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/main X-Git-Reftype: branch X-Git-Commit: 2bd0506c8d94a2c581dd16407f3a1c159a38769b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 May 2021 16:20:42 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2bd0506c8d94a2c581dd16407f3a1c159a38769b commit 2bd0506c8d94a2c581dd16407f3a1c159a38769b Author: Konstantin Belousov AuthorDate: 2021-04-30 21:14:26 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-03 16:13:48 +0000 kern_ptrace: change type of proctree_locked to bool Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29955 --- sys/kern/sys_process.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 27a690e65638..492ef287ca53 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -612,13 +612,14 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) struct ptrace_lwpinfo *pl; struct ptrace_sc_ret *psr; int error, num, tmp; - int proctree_locked = 0; lwpid_t tid = 0, *buf; #ifdef COMPAT_FREEBSD32 int wrap32 = 0, safe = 0; #endif + bool proctree_locked; curp = td->td_proc; + proctree_locked = false; /* Lock proctree before locking the process. */ switch (req) { @@ -636,7 +637,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) case PT_DETACH: case PT_GET_SC_ARGS: sx_xlock(&proctree_lock); - proctree_locked = 1; + proctree_locked = true; break; default: break; @@ -816,7 +817,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) p->p_oppid); sx_xunlock(&proctree_lock); - proctree_locked = 0; + proctree_locked = false; MPASS(p->p_xthread == NULL); MPASS((p->p_flag & P_STOPPED_TRACE) == 0); @@ -1053,10 +1054,10 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) } sx_xunlock(&proctree_lock); - proctree_locked = 0; + proctree_locked = false; sendsig: - MPASS(proctree_locked == 0); + MPASS(!proctree_locked); /* * Clear the pending event for the thread that just