From 38d067a31706492a841ac90deadd02dd8a32550f Mon Sep 17 00:00:00 2001 From: kib Date: Fri, 1 Jul 2016 20:11:28 +0000 Subject: [PATCH] When a process knote was attached to the process which is already exiting, the knote is activated immediately. If the exit1() later activates knotes, such knote is attempted to be activated second time. Detect the condition by zeroed kn_ptr.p_proc pointer, and avoid excessive activation. Before r302235, such knotes were removed from the knlist immediately upon activation. Reported by: truckman Sponsored by: The FreeBSD Foundation Approved by: re (gjb) --- sys/kern/kern_event.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 84bef459d23f..575a330d9b20 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -451,6 +451,9 @@ filt_proc(struct knote *kn, long hint) u_int event; p = kn->kn_ptr.p_proc; + if (p == NULL) /* already activated, from attach filter */ + return (0); + /* Mask off extra data. */ event = (u_int)hint & NOTE_PCTRLMASK;