[uClibc]realloc broken (Was: Re: pthread implementation broken with -D_GNU_SOURCE)
Ronald Wahl
rwa at peppercon.com
Mon Jul 1 07:59:14 UTC 2002
On 28 Jun 2002 17:08:44 +0200, Ronald Wahl wrote:
> On 27 Jun 2002 16:14:28 +0200, Ronald Wahl wrote:
>> Hallo,
>> I just noticed that some routines like pthread_mutex_lock fail if the
>> calling program was compiled with -D_GNU_SOURCE. The reason is that
>> these functions do not check all types of mutexes - in my case
>> PTHREAD_MUTEX_TIMED_NP (the standard mutex type) falls through the
>> switch statement and so pthread_mutex_lock returns EINVAL. Maybe
>> the pthread library should be synced with a newer one (these include
>> the missing code). I hope this can be fixed soon.
> ... and am I right when I say that because of this bug parts of uClibc
> (these that use the statical PTHREAD_MUTEX_INITIALIZER) are currently
> not thread-safe? Since the return value of pthread_mutex_lock is not
> checked the bug remains hidden.
Everything is broken ;-( Now realloc - if used with _working_
mutexes. I have two fixes - one to get the locks working and one to fix
the malloc problem. Get them here and incorporate them into uClibc:
http://www.peppercon.de/~rwa/malloc-nodeadlock.patch
http://www.peppercon.de/~rwa/libpthread.patch
Maybe the mutex patch uncovers some other hidden bugs...
thanx,
ron
--
\\ Dipl.-Inf. Ronald Wahl | Peppercon AG //
\\\ rwa at peppercon.com ||| http://www.peppercon.com/ ///
\OO ----------------------- OOO ------------------------- OO/
OO GnuPG/PGP key available OOO Keep Systems running OO
More information about the uClibc
mailing list