git: 009268dbfdd5 - stable/14 - hwpmc: On attach, fix allowing a PMC's owner to attach it to itself
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 18 Sep 2025 10:13:42 UTC
The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=009268dbfdd5fe487117654f75ae3850a2c1a7d9 commit 009268dbfdd5fe487117654f75ae3850a2c1a7d9 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2025-09-09 12:48:05 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2025-09-18 10:13:10 +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 21f416510d5e..54fcc2dafb4f 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -1042,7 +1042,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;