From nobody Thu Aug 25 17:31:45 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 4MD94f18Xjz4b3Dp; Thu, 25 Aug 2022 17:31:46 +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 4MD94d72pvz3LYP; Thu, 25 Aug 2022 17:31:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661448706; 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=QJuOr+IuK8HnicQ4mReX5FWq+OfhO+ZPcqA5E/CTBf4=; b=MEW5ECFchRcK0RYXeI1uH2VhPai272iZM8uNVL0uMIZGHoIFHoppu7svcSAZ4SPdqtYk46 5hYClKXDir5UwemUl0bJUmKPqAZ59jLHIDoK1n+gvFsdYxoIgVAIc89qE8esv4acd1iUDO vpm8XZ0yQks9VSTZERguHH2/1+f35vty6Qc84L6Eg4wjZQt+NgeXkOYezTXH8aPTYuXXU8 f5F5AqUmRGhU+AgMbJR41fTQn9eiz6McZH1a46MVUegtw527Cxe+uwwX8RRv3fWiMvboKU mvK2Y4tL/RM5jzI6oitvBsW3gMfSw6ymwSldtNq6KtCSX6NwKKMP//CTWhK4pg== 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 4MD94d69DDzwkF; Thu, 25 Aug 2022 17:31:45 +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 27PHVjmo043732; Thu, 25 Aug 2022 17:31:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27PHVjxf043731; Thu, 25 Aug 2022 17:31:45 GMT (envelope-from git) Date: Thu, 25 Aug 2022 17:31:45 GMT Message-Id: <202208251731.27PHVjxf043731@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 49afea105912 - main - proc: read the pid prior to unlocking in report_alive_proc1 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 49afea10591249b6cb73ea1c51a28d2334d7dd52 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661448706; 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=QJuOr+IuK8HnicQ4mReX5FWq+OfhO+ZPcqA5E/CTBf4=; b=Q7PZUgpUha35lUVM8UcqumxgS4d8BxFaQqC/C9wQAKOGeaA7HJ3Ppi6WIRytrDJjslKkY4 LeUZrr9TYa+/CoJjQA9l6yNq4XGIINAOWTtdrUmFd7T8rgdumBzL+kt2mvj+EPxJfkyo4s HWJkTKf7OZbVdM2J+ez52VlGHul1Fa+GIb9mxaIAzNwY14Fnh6gGZak1dIDWlk3xYmOS05 oVxfumMHSKRRgFaDTVudJHQavdw97KEVrhnPf9wLyUaep0q4Rn27hfOsBBBAGl1O7XDpTT v7fhVEGiQgo4A42rWZwwT615o/woDaRvO0Da53MQ3QG67F/R4Upvha+OBi+UmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661448706; a=rsa-sha256; cv=none; b=SI37M1bQlKh6ovfJM/0IT7RayhFNz4gTJHoHdZdrPMBUj/Ko74mkFyP7P6Nthh3CeVMxeZ vmFFU3cnHzR3XdlwYlZafqfF1iZPpjQvBVCxOoe1C3vauGH0kaBYHzDeKQHFYgm3EuHWI9 PEsodw40gD1yPzBm5um2QKuEjoeSfnic+3LDfwBjqOd8vQxipxgXXUh3kVHqftX+MwPsZQ 78oLSVWjBsYLjPqEe7DS5aCibwyfXBTPaxMIbTm/fxinvbmkNPz00to82Y0IQk6hDYUG2c mB14TYJQR7yp6QgV6L5fMGsjEhLPCogz5+pr1APMLhJhgAOuqa2h+PuIw1dZoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=49afea10591249b6cb73ea1c51a28d2334d7dd52 commit 49afea10591249b6cb73ea1c51a28d2334d7dd52 Author: Mateusz Guzik AuthorDate: 2022-08-25 17:26:49 +0000 Commit: Mateusz Guzik CommitDate: 2022-08-25 17:26:49 +0000 proc: read the pid prior to unlocking in report_alive_proc1 In principle another thread could have reaped the process by that time. --- sys/kern/kern_exit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index cb51193a26e0..4cf31aa73e56 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1269,8 +1269,8 @@ report_alive_proc(struct thread *td, struct proc *p, siginfo_t *siginfo, } if (status != NULL) *status = cont ? SIGCONT : W_STOPCODE(p->p_xsig); - PROC_UNLOCK(p); td->td_retval[0] = p->p_pid; + PROC_UNLOCK(p); } int