From nobody Thu Sep 18 08:51:57 2025 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 4cS8Wx6ngWz6826L; Thu, 18 Sep 2025 08:51:57 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cS8Wx4t8pz3hjK; Thu, 18 Sep 2025 08:51:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758185517; 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=Xi2Dp1iM+xN7GZ8ia9aTaRclcGgI2yPw1zeFMDbyGeM=; b=T2lEYW1y2qbUPQ/z4Djl3zukfXG07uvp8NxmIF0ZHajqHDfHjwWMEAndE7zNETt12gggfp DOCyItXiu/wgevigsqrC/7GmdUzPurQJV2jl1kvY6+QF6LSvFSRErT8i8RDpPHA9ryanf5 f6p/NYx1/+olDYtPPAkF3ngcRqcyZTJ/MRfWggEJ2SMPG1cSKMcweAfEXGZSRFo7IdJhFd lz3UXAklhATNXtEyyIlM8UU2emt0zZocteF2dKytRy02c4i4ST6/JyrBoC3nke7xqxTyw9 yORmKWuBzzuKyIOkeRn2eylZWMG+/0AYhUSZsqClWe5bJhYZqMvTU6GFE6EaqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758185517; 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=Xi2Dp1iM+xN7GZ8ia9aTaRclcGgI2yPw1zeFMDbyGeM=; b=Md7SyE9serKo4I2NjaydCQcedfz2pgB0XSnMdNV76Pz2Q7NcQhF1c7rZmjbHX0rCDnyYHj A6sOE1pxTZ03YBnlcwy/Qy2K4Tt11DZ0TE4Yd18DXEnZTCvaFfu8eDlDl5IJb5itOren2L V0nRM8Nh+UnoiIIaRCcApTPUIAxP+4uDWK1bv7t7YLTfQb/RR+tz2tYD1gZ21oL+2aKkqV VxY1uriq7FxgLrtQWQggSoMSzmD83XiP111aCK4DdJf+PQQfNXSfLY6CfKByiyNQg0i9gx WFOORSJf/X7MSVMg2YfMrnorkLnay1MHymql95fpxE1W9neM207f6EHR0/z8Uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758185517; a=rsa-sha256; cv=none; b=TRJdTrAMEE0jUv/Z7jMrqlUQNnj33Qb5y2iTVLC8ifQqGb4o+EGxBGc3950SMHrF3CidLk P3zxargoXJsWAG2clSMtkWxWoy+S8PFsQlKu19z2xLFS+uJI2LLjSUW2eqUTnJ9qhT/ADj h7Rlqf7nAhvYly3WSx2k/CzwDAgbjOCe7rLR5mBbj/EDiQivuUqtykxi70ruHle3kYfVAY qGMkGaDfNMa0x8sZk4prxEpUOdzOsZ2bWqm44+Vd9VUZVKVlrlpPhopB5XQcQcbWKzskM1 46bsAH+54x+AbkfTRcrrOgoG/5b/5zESoscVZH1upu68gxFpHqx9VGNyjeRvKw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4cS8Wx47mkz147s; Thu, 18 Sep 2025 08:51:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58I8pvBW017334; Thu, 18 Sep 2025 08:51:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58I8pvXG017331; Thu, 18 Sep 2025 08:51:57 GMT (envelope-from git) Date: Thu, 18 Sep 2025 08:51:57 GMT Message-Id: <202509180851.58I8pvXG017331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 30ea55ff5eea - stable/15 - hwpmc: On attach, fix allowing a PMC's owner to attach it to itself 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: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 30ea55ff5eea80ee9b1e021b151b16c799fb288d Auto-Submitted: auto-generated The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=30ea55ff5eea80ee9b1e021b151b16c799fb288d commit 30ea55ff5eea80ee9b1e021b151b16c799fb288d Author: Olivier Certner AuthorDate: 2025-09-09 12:48:05 +0000 Commit: Olivier Certner CommitDate: 2025-09-18 08:50:28 +0000 hwpmc: On attach, fix allowing a PMC's owner to attach it to itself The returned value in this case was wrong, and would basically prevent some PMC's owner process to attach that PMC to itself although the security checks underneath would have allowed it. Now that this early return has been fixed, its block basically becomes a performance short-circuit which has no effect from a functional standpoint. Fixes: ebccf1e3a6b1 ("Bring a working snapshot of hwpmc(4), ...") MFC after: 9 days Sponsored by: The FreeBSD Foundation (cherry picked from commit 1c40b15971f09c0c0676ae476b88b32166eae8ac) --- sys/dev/hwpmc/hwpmc_mod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 15c782b91b69..a6a6ae68996c 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -1041,7 +1041,7 @@ pmc_can_attach(struct pmc *pm, struct proc *t) */ if ((o = pm->pm_owner->po_owner) == t) - return (false); + return (true); PROC_LOCK(o); oc = o->p_ucred;