aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2025-09-09 12:48:05 +0000
committerOlivier Certner <olce@FreeBSD.org>2025-09-09 15:56:47 +0000
commit1c40b15971f09c0c0676ae476b88b32166eae8ac (patch)
tree2d613430bc221e0d76e4fbbb3d4ebcec7e67c60f
parent1c3c698ba4c40485ebbbd157cb49172cfa7de9b2 (diff)
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
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c2
1 files changed, 1 insertions, 1 deletions
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;