summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorcognet <cognet@FreeBSD.org>2003-11-04 01:14:58 +0000
committercognet <cognet@FreeBSD.org>2003-11-04 01:14:58 +0000
commita3a383926fd92318ce4e0edb4e1aa810b688150c (patch)
tree7cba2c5f5df3984a89b7f88fef15cff62b9cbfdf /sys/kern
parent001816b2ace839c43043f10999984076aa2dfb9e (diff)
downloadFreeBSD-src-a3a383926fd92318ce4e0edb4e1aa810b688150c.zip
FreeBSD-src-a3a383926fd92318ce4e0edb4e1aa810b688150c.tar.gz
Do not attempt to report proc event if NOTE_EXIT has already been received.
This fixes a race condition (specifically with signal events) that could lead to the kn being re-inserted into the list after it has been destroyed, which is not something we want to happen. PR: kern/58258
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_event.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index a9e42de..85ee24e 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -280,6 +280,13 @@ filt_proc(struct knote *kn, long hint)
}
/*
+ * Process will already be reported as gone.
+ * Do not report anything else, as the knote will be destroyed soon.
+ */
+ if (kn->kn_status & KN_DETACHED)
+ return (0);
+
+ /*
* process forked, and user wants to track the new process,
* so attach a new knote to it, and immediately report an
* event with the parent's pid.
OpenPOWER on IntegriCloud