Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jul 2016 20:11:28 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302308 - head/sys/kern
Message-ID:  <201607012011.u61KBSEL044547@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Jul  1 20:11:28 2016
New Revision: 302308
URL: https://svnweb.freebsd.org/changeset/base/302308

Log:
  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)

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c	Fri Jul  1 19:58:13 2016	(r302307)
+++ head/sys/kern/kern_event.c	Fri Jul  1 20:11:28 2016	(r302308)
@@ -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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607012011.u61KBSEL044547>