aboutsummaryrefslogtreecommitdiff
path: root/sys/gnu
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2026-08-24 14:57:16 +0000
committerMark Johnston <markj@FreeBSD.org>2026-08-24 18:41:23 +0000
commit97e1e603bd40630d0a2e0f5e2716e4a7b8b3a0be (patch)
tree7f509d66b81228aa7bbaa8cf9bcfec7a228ab80c /sys/gnu
parent357aa8af5304bc7abe9191da3cbe9852f72eeee2 (diff)
hwpmc: Fix the execve handler
When a process execve()s, pmc_process_exec() is supposed to evaluate whether the new image is setuid/setgid and if so, whether to detach PMCs. This was handled by pmc_can_attach(), which is effectively an open-coded copy of cr_xids_subset(). Unfortunately, the test of the result of this function was inverted, with the result that we'd detach PMCs only if the predicate said it was okay to do so. It appears the bug has always been there; it seems the intent was to return 0 on "success", i.e., it is okay to attach the PMCs, much like p_candebug(). Commits 1c3c698ba4c4 and 1c40b15971f0 obscured this a bit. I think this check is trying to be too clever. Let's make it simpler: simply do not attach PMCs unless the owner is privileged. This is how, e.g., ktrace works. I do not think it's worth trying to be more sophisticated than this unless we can generalize the policy in a way that's applicable to other subsystems. Also fix a bug at the end of pmc_process_exec(): pmc_detach_one_process() will call pmc_remove_process_descriptor() for us. Approved by: so Security: FreeBSD-SA-26:56.hwpmc Security: CVE-2026-58089 Reported by: netchild Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D59102
Diffstat (limited to 'sys/gnu')
0 files changed, 0 insertions, 0 deletions