kern/55007: btoken close() on kqueue filter descriptors.

Roman Nikitchenko hc at www.trifle.net
Tue Jul 29 03:00:35 PDT 2003


>Number:         55007
>Category:       kern
>Synopsis:       btoken close() on kqueue filter descriptors.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 29 03:00:32 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Roman Nikitchenko
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Trifle Co. Ltd.
>Environment:
System: FreeBSD hc.apex.dp.ua 4.8-STABLE FreeBSD 4.8-STABLE #0: Mon Jul 28 18:51:32 EEST 2003 hc at hc.apex.dp.ua:/usr/src/sys/compile/HC i386
>Description:
    File descriptors obtained through kqueue() call can't be closed using
    uthread_close() because of non-libc_r kqueue() implementation and
    _thread_fd_table checks on uthread_close(). I see this behaviour after
    checks in /usr/src/lib/libc_r/uthread/uthread_close.c in the
    following branches:
    MAIN: after revision 1.14, RELENG_4_8_BP after revision 1.10.2.4.
>How-To-Repeat:
    Link against libc_r anything like this:

	int poller = kqueue();
	if ( close( poller ) < 0 )
	    perror( "close" );
>Fix:
    Write uthread_kqueue() function inserting new kqueue() descriptor into
    _thread_fd_table (maybe better way exists, but this is all i found).

    As workaround: syscall( SYS_close, fd ), but this is too dirty.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list