From nobody Tue Sep 9 15:57:58 2025 X-Original-To: dev-commits-src-main@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 4cLpPg3P0mz675vN; Tue, 09 Sep 2025 15:57:59 +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 4cLpPf6x0tz48tc; Tue, 09 Sep 2025 15:57:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757433479; 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=Yz4s6XJrvZzDuYg5wmlSdGS0YwX7MTohAzpzYjQp0rk=; b=jGDdjUM/p50ZyA7h7PUcz4KXhiABoLWNOgRgEl8AF9UzOJa1auy9iS3L9o/9pLkEHErtKg J5vIYIsvqAFCCKLsGfcludTjeAUcpl4GxIw9YpfVfsaVOkUmwUJ+CjVU5ADgi1kbj4z0EB D8MXXw2J0xPwr2F+n0BGtUtBA+UzJCjdb/aL69hxXFugfVenH+9F8q6SkJKy2rOnE2EdRo aLEpG2l4uD6FciBTe992vz2sPq8uIlDwyH/3XdLyy0Mvd8OBU62tRxBSV3Zw8vrL67O8I2 a0WwDeGY6rrOs1G6aDcDj6MrsyFbbwwPpKdaTfXFbpbfh8FGYUopt9A5BJmiJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1757433479; 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=Yz4s6XJrvZzDuYg5wmlSdGS0YwX7MTohAzpzYjQp0rk=; b=BJYxRNo7qzwqX8edKQSSjifQSRtMzeVomzSgUmsU6rTdJ/EloMpH0ynwPrDGhRBzLwjGWr dN+BVODHnKrKoGx/QEBoncVsTZ9FxQgYuZqdd6ZXVy0wbO8qTpu2Efnr1yofrpkDZc+jCx gehMQVp61Pd44HIkvc2HQdi6RIhaMmrgjGLNaZShmwRjpxyuuSlF5ZJam/CEwDAIf5elAI ztt/waJ7gCT9EMUDkVJWNtU0to7UalhAm6cdWUm/cCwH+DJHoU4BJwzOWftQSFcQJ0Ajj5 cW+FrMv3d7QsZx1V/Vfg2d1lpY4DOnt0/+/diJZ9qx0CrvviGHd1vMMNxHWHgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1757433479; a=rsa-sha256; cv=none; b=GUL+WfxtPaRUZDpkglOjkk1d4zWHxZfuCUKNp7R3fVcxBlTaTRke8gOAOVP9orYezWzf2q yaFsFF1mbE8tpiGeOVKrHFQL4uUBiNgfJ/BzLfpWSfsf3u8ZNHZNfCRL8yDodpu4IYgpYC 6t044a3OpRJik9ZuEQlfbs75m/iHzhEgqYPg8Ou1lG0RCxqja3BG0hdGZRZeuAJPZtuaoJ wohGVGwGLJTCKjexQnSPk/3KOhh0SeNTblcUmwS2KnehjCtqJsXn45V/YFe199SDqj5lSz acAMpa6MofgrPBZiF/PFMAgKpew1u9bHkA62NeA2E2pCChNeYQz2O5Gh+VeLLQ== 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 4cLpPf6Gyzzk4Z; Tue, 09 Sep 2025 15:57:58 +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 589FvwJk039250; Tue, 9 Sep 2025 15:57:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 589Fvwj9039247; Tue, 9 Sep 2025 15:57:58 GMT (envelope-from git) Date: Tue, 9 Sep 2025 15:57:58 GMT Message-Id: <202509091557.589Fvwj9039247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 1c40b15971f0 - main - hwpmc: On attach, fix allowing a PMC's owner to attach it to itself List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 1c40b15971f09c0c0676ae476b88b32166eae8ac Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=1c40b15971f09c0c0676ae476b88b32166eae8ac commit 1c40b15971f09c0c0676ae476b88b32166eae8ac Author: Olivier Certner AuthorDate: 2025-09-09 12:48:05 +0000 Commit: Olivier Certner CommitDate: 2025-09-09 15:56:47 +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 --- 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;