git: 283e60fb310a - main - ktrace: Fix an inverted comparison added in commit f3851b235

Mark Johnston markj at FreeBSD.org
Tue Jun 1 13:17:24 UTC 2021


The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=283e60fb310abb0f77405bab2cc431690b9b262d

commit 283e60fb310abb0f77405bab2cc431690b9b262d
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-06-01 13:15:35 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-06-01 13:15:35 +0000

    ktrace: Fix an inverted comparison added in commit f3851b235
    
    Fixes:          f3851b235 ("ktrace: Fix a race with fork()")
    Reported by:    dchagin, phk
---
 sys/kern/kern_ktrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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


More information about the dev-commits-src-all mailing list