Re: 5.3-RC2: kqueue descriptor leak in resolver functions?

From: Jonathan Lennox <lennox_at_cs.columbia.edu>
Date: Thu, 4 Nov 2004 17:23:28 -0500
Arjan de Vet writes:
> A ktrace of the mozilla process seems to point to the DNS resolver code
> leaking kqueue descriptors (I could not find any kqueue() calls in the
> mozilla code itself).

I've noticed (and reported) this with 5.2.1, in the specific case when
you're using libc_r and linking statically.  I never heard anything back,
though.

The problem is that 'kqueue' isn't namespace'd (#defined as _kqueue) in
lib/libc/include/[un]namespace.h, and the thread libraries don't draw in
_kqueue in their 'references' array.

Attached below is a patch against 5.2.1.  It should apply to 5.3-RC2 as
well.  The patch for lib/libc_r/uthread/uthread_init.c may also need to be
applied to lib/libpthread/thread/thr_init.c and
lib/libthr/thread/thr_init.c.

See PR bin/58687.

--- lib/libc_r/uthread/uthread_init.c.orig	Wed Oct 29 11:00:53 2003
+++ lib/libc_r/uthread/uthread_init.c	Wed Oct 29 11:01:21 2003
_at__at_ -99,6 +99,7 _at__at_
 	&_getsockopt,
 	&_ioctl,
 	&_kevent,
+	&_kqueue,
 	&_listen,
 	&_nanosleep,
 	&_open,
--- lib/libc/include/namespace.h.orig	Wed Oct 29 14:13:09 2003
+++ lib/libc/include/namespace.h	Wed Oct 29 14:13:31 2003
_at__at_ -77,6 +77,7 _at__at_
 #define		getsockopt			_getsockopt
 #define		ioctl				_ioctl
 /* #define		kevent				_kevent */
+#define		kqueue				_kqueue
 #define		listen				_listen
 #define		nanosleep			_nanosleep
 #define		open				_open
--- lib/libc/include/un-namespace.h.orig	Wed Oct 29 14:13:13 2003
+++ lib/libc/include/un-namespace.h	Wed Oct 29 14:13:55 2003
_at__at_ -58,6 +58,7 _at__at_
 #undef		getsockopt
 #undef		ioctl
 #undef		kevent
+#undef		kqueue
 #undef		listen
 #undef		nanosleep
 #undef		open


-- 
Jonathan Lennox
lennox_at_cs.columbia.edu
Received on Thu Nov 04 2004 - 21:24:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:21 UTC