Date: Fri, 24 Jan 2003 19:12:47 -0800 From: David Schultz <dschultz@uclink.Berkeley.EDU> To: diego el gordito <diegoelgordito@yahoo.com> Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: pthreads bug - memory leak Message-ID: <20030125031247.GA300@HAL9000.homeunix.com> In-Reply-To: <20030124212910.79359.qmail@web14503.mail.yahoo.com> References: <20030124212910.79359.qmail@web14503.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Thus spake diego el gordito <diegoelgordito@yahoo.com>: > It seems to me that I've found a bug in the pthreads > library which leads to a huge memory leak. I haven't > bothered to look at the sources since it really > doesn't seem too serious (for an attack). > > Tested in OpenBSD 3.1 and 3.2 GENERIC#0 also found in > FreeBSD and I'm still missing other operating systems > to test it on. The linux implementation didn't seem > vulnerable. > > The bug shows up when calling pthread_cond_timedwait() > from the main program thread (not a thread created > with pthread_create()). I'm not 100% sure but there > must be some other functions of the library which get > executed through the same conditions and therefore > leak memory. Your code seems to have a bug. You can't use the static initializers like PTHREAD_COND_INITIALIZER to initialize automatic variables. Either make condition_cond static, or use pthread_cond_init() and pthread_cond_destroy() instead, and likewise for mutexes. Your code probably happened to work in Linux because you happen to be passing the same stack address in each call to the pthreads functions. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030125031247.GA300>