From nobody Tue Apr 30 07:07:24 2024 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 4VTB8s0LGbz5JMxR; Tue, 30 Apr 2024 07:07:25 +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 4VTB8r6qD2z593h; Tue, 30 Apr 2024 07:07:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714460845; 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=zBVo1QXtQG/ub2LzbyDBdikCIyYesLz5jANiLODNR+0=; b=URwi1r0EQsh5FaKwxroGEruxGiz+mtOTa/yQ5PtKjGBnWguWQ/rTKY/OXx/cRkSIDd21qn kzQw76Lf1mI3N/XxKsnY1DCEyShmAiNjUq5Vbg5kQSvB+8856JdNXjZyM9An+nA0wmcGmD s5qpGK1KS/kDCFbdvszOyiFPIvMAv8atpsUFFMZhvkm4UCCAUs7IHyfePZGTSxqv1vxlMo sHUnmf0aKegwHUbBQ3tr06nFXxWQ92+pqZ1c3+hg9WlXsztEdrXxdhlcN5mok+W3+xdAMc 561T/leXVd/yXoaGUG2KFEUwyYE+Nm0gBwYUsAcR4caCz6UrMErE5kO7b6r2Bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714460845; a=rsa-sha256; cv=none; b=cu0NmSTkbiuVV7VDlb0O7n153/vF7vto3DSAwisqBmBddVNombc2lRNjmw7zqVKoR8k8Lz KmtvXbJKGoF5qZabXcuzlxFP4zj//z/ccXTHC4XJcebSlIV+B5cLTIVQ290ri4qVbAEVT9 cW/0EDjrCUNyMsghTnKZLrR5HT49UGarwFwSzIkhnLReKJDWn3nXtIwMJ1Mt9J2jAjBNdX jOAuPfroa+gx1K830crsXneIvUbFAYXOqEyTMepq0tirAOUBS4WmaWik8SulpGrT8HoSL8 4X0tj3QH8WDDX5gVGVWxepVK8LJ/mTuGM7vXhGPt93lLmlI8y8wqG93tGC3BvQ== 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=1714460845; 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=zBVo1QXtQG/ub2LzbyDBdikCIyYesLz5jANiLODNR+0=; b=yWSqOFk5qt+9Kn+IWx5xdLRlpWZdHaH1syat4In6rztL7uakBzAWxsoe7eHGRSnV009Xqa ySPTWeHJLpcLeWtgpgANTELJLjkBtQJ8tOsn34s9Luc7YBjKp4GJ+5Du6Yxk04VAiC+Yz6 C1mrtd8lZsoO7CmiIC+LvHXyuTzcJJ3jm/60fnO6Gb95BU8Ekiy3HDIrXVbZ3Hwgidc/gJ lLb1LNtoRa2T48xW38rah4C3ji3YozXN4GjZeMXbrdfwHMsYiUECKkXP3y7LExAPY9nhIt uYAxqDPPsNNMh3PdwwjH9MJxLEdEnWt6FxTNBM45tVKBDply+ZRkO2XsJXNiNQ== 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 4VTB8r6Q6rzQNJ; Tue, 30 Apr 2024 07:07:24 +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 43U77O1O058281; Tue, 30 Apr 2024 07:07:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43U77OWe058278; Tue, 30 Apr 2024 07:07:24 GMT (envelope-from git) Date: Tue, 30 Apr 2024 07:07:24 GMT Message-Id: <202404300707.43U77OWe058278@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: 1e01650a7870 - main - kcmp_pget(): add an assert that we did not hold the current process 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/main X-Git-Reftype: branch X-Git-Commit: 1e01650a787028fd558e8cb709c232e335fc2cd9 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1e01650a787028fd558e8cb709c232e335fc2cd9 commit 1e01650a787028fd558e8cb709c232e335fc2cd9 Author: Konstantin Belousov AuthorDate: 2024-04-29 18:51:53 +0000 Commit: Konstantin Belousov CommitDate: 2024-04-30 07:06:52 +0000 kcmp_pget(): add an assert that we did not hold the current process Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/kern/sys_generic.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index b926f98892a5..cc1126ac4dc4 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -2092,11 +2092,15 @@ kcmp_cmp(uintptr_t a, uintptr_t b) static int kcmp_pget(struct thread *td, pid_t pid, struct proc **pp) { + int error; + if (pid == td->td_proc->p_pid) { *pp = td->td_proc; return (0); } - return (pget(pid, PGET_CANDEBUG | PGET_NOTWEXIT | PGET_HOLD, pp)); + error = pget(pid, PGET_CANDEBUG | PGET_NOTWEXIT | PGET_HOLD, pp); + MPASS(*pp != td->td_proc); + return (error); } int