aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-06-01 13:15:35 +0000
committerMark Johnston <markj@FreeBSD.org>2021-06-01 13:15:35 +0000
commit283e60fb310abb0f77405bab2cc431690b9b262d (patch)
tree6b59f8652999f17c6327810e320d3868949cd782
parentb501b2ae52f3ccb384584dcbb5dc4a4568cc0096 (diff)
downloadsrc-283e60fb310abb0f77405bab2cc431690b9b262d.tar.gz
src-283e60fb310abb0f77405bab2cc431690b9b262d.zip
ktrace: Fix an inverted comparison added in commit f3851b235
Fixes: f3851b235 ("ktrace: Fix a race with fork()") Reported by: dchagin, phk
-rw-r--r--sys/kern/kern_ktrace.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index 4a2dad20b035..87cea3f269d5 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -1176,7 +1176,8 @@ ktrops(struct thread *td, struct proc *p, int ops, int facs,
PROC_UNLOCK(p);
return (0);
}
- if ((ops == KTROP_SET && p->p_state == PRS_NEW) || !p_cansee(td, p)) {
+ if ((ops == KTROP_SET && p->p_state == PRS_NEW) ||
+ p_cansee(td, p) != 0) {
/*
* Disallow setting trace points if the process is being born.
* This avoids races with trace point inheritance in