From stripes@torb.pix.net  Mon Aug 13 16:02:00 2001
Return-Path: <stripes@torb.pix.net>
Received: from torb.pix.net (torb.pix.net [192.135.81.20])
	by hub.freebsd.org (Postfix) with ESMTP id 5102A37B406
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 13 Aug 2001 16:01:59 -0700 (PDT)
	(envelope-from stripes@torb.pix.net)
Received: (from stripes@localhost)
	by torb.pix.net (8.11.4/8.11.4) id f7DN1w805346;
	Mon, 13 Aug 2001 19:01:58 -0400 (EDT)
	(envelope-from stripes)
Message-Id: <200108132301.f7DN1w805346@torb.pix.net>
Date: Mon, 13 Aug 2001 19:01:58 -0400 (EDT)
From: stripes@iamsofired.com
Reply-To: stripes@iamsofired.com
To: FreeBSD-gnats-submit@freebsd.org
Cc: stripes@iamsofired.com
Subject: kevent EV_ADD EVFILT_WRITE does the wrong thing on a closed fd
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         29686
>Category:       kern
>Synopsis:       kevent EV_ADD EVFILT_WRITE does the wrong thing on a closed fd
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug 13 16:10:01 PDT 2001
>Closed-Date:    Sun Nov 12 10:31:46 GMT 2006
>Last-Modified:  Sun Nov 12 10:31:46 GMT 2006
>Originator:     jmo
>Release:        FreeBSD 4.3-RELEASE i386
>Organization:
Not relivant
>Environment:
System: FreeBSD -noname- 4.3-RELEASE FreeBSD 4.3-RELEASE #1: Thu Jun 21 08:44:59 EDT 2001 stripes@torb.pix.net:/usr/src/sys/compile/PLASTIC i386


	P-III, 4.3-RELEASE, libc
>Description:
	I have a one shot EVFILT_WRITE filter on fd#7, it fires, and I close 
	fd#7.  My code (incorrectly) asks for the filter to be added again  
	without opening the file descriptor again (fd#7 is a TCP stream, when
	open).  kevent does not return with EBADF as I think it should.  This
	might be a documentation issue, maybe someone really does want to
	be told about events on fd#7 after they open it.  I would rather the
	EBADF though.

	kevent does return telling me I can write some data down the CLOSED
	fd#7.  That's just wrong.

	Since we are trying to promote kevent as the new bestest way to do
	event driven I/O and stuff, having it be harder to use then needed
	seems like a bad idea.  That's why I said the bug is "serious" even
	though the work around is "don't write the user land code to do The
	Wrong Thing".

>How-To-Repeat:
	I can't submit the code, it was done for work.  This pr isn't even from
	the same machine (I did put the problem machine's info in, not my own
	machine's info).
>Fix:
	None, but as a work around, be careful not to ask for events on closed
	files.  I admit I did the wrong thing there, but it will be easier to
	spot that if the kernel tells you right away...
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jlemon 
Responsible-Changed-By: kris 
Responsible-Changed-When: Sat Jan 5 20:09:16 PST 2002 
Responsible-Changed-Why:  
jlemon wrote kq 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=29686 
Responsible-Changed-From-To: jlemon->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Sep 13 05:59:17 GMT 2004 
Responsible-Changed-Why:  
With bugmeister hat on, reassign from recently inactive committer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=29686 
State-Changed-From-To: open->feedback 
State-Changed-By: rodrigc 
State-Changed-When: Sun Jun 4 23:37:43 UTC 2006 
State-Changed-Why:  
Can you submit a small code testcase which illustrates the problem? 
It's hard to look at this otherwise. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=29686 
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Sun Nov 12 10:31:43 UTC 2006 
State-Changed-Why:  
Feedback had not been recieved, please submit feedback so that we can 
continue to look into this problem. Till that time i will be closing the 
PR 

http://www.freebsd.org/cgi/query-pr.cgi?pr=29686 
>Unformatted:
