musl - an implementation of the standard library for Linux-based systems
Go to file
Rich Felker 88c4e72031 overhaul posix semaphores to fix destructability race
the race condition these changes address is described in glibc bug
report number 12674:

http://sourceware.org/bugzilla/show_bug.cgi?id=12674

up until now, musl has shared the bug, and i had not been able to
figure out how to eliminate it. in short, the problem is that it's not
valid for sem_post to inspect the waiters count after incrementing the
semaphore value, because another thread may have already successfully
returned from sem_wait, (rightly) deemed itself the only remaining
user of the semaphore, and chosen to destroy and free it (or unmap the
shared memory it's stored in). POSIX is not explicit in blessing this
usage, but it gives a very explicit analogous example with mutexes
(which, in musl and glibc, also suffer from the same race condition
bug) in the rationale for pthread_mutex_destroy.

the new semaphore implementation augments the waiter count with a
redundant waiter indication in the semaphore value itself,
representing the presence of "last minute" waiters that may have
arrived after sem_post read the waiter count. this allows sem_post to
read the waiter count prior to incrementing the semaphore value,
rather than after incrementing it, so as to avoid accessing the
semaphore memory whatsoever after the increment takes place.

a similar, but much simpler, fix should be possible for mutexes and
other locking primitives whose usage rules are stricter than
semaphores.
2011-08-02 19:19:09 -04:00
arch socket headers macro adjustment - workaround for buggy programs 2011-07-21 22:44:05 -04:00
crt cleanup comment cruft in startup code 2011-02-21 22:27:35 -05:00
dist cleanup shared library build system to be more $HOME-local-install friendly 2011-06-27 21:38:11 -04:00
include consistency: use struct __ucontext instead of ucontext_t in prototypes 2011-07-31 00:10:29 -04:00
lib new solution for empty lib dir (old one had some problems) 2011-02-17 17:12:52 -05:00
src overhaul posix semaphores to fix destructability race 2011-08-02 19:19:09 -04:00
tools cleanup shared library build system to be more $HOME-local-install friendly 2011-06-27 21:38:11 -04:00
COPYING initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00
COPYRIGHT XSI search.h API implementation by Szabolcs Nagy 2011-06-25 18:18:57 -04:00
INSTALL minor updates to INSTALL documentation 2011-06-27 22:34:47 -04:00
Makefile fix a few bugs from last dynamic linking build system commit 2011-06-28 08:27:38 -04:00
README update README since we now DO have a mailing list 2011-04-11 00:10:26 -04:00
WHATSNEW 0.7.12 release notes 2011-07-03 16:41:20 -04:00

README

musl libc - a new standard library to power a new generation of
Linux-based devices. musl is lightweight, fast, simple, free, and
strives to be correct in the sense of standards-conformance and
safety.

musl is an alternative to glibc, eglibc, uClibc, dietlibc, and klibc.
For reasons why one might prefer musl, please see the FAQ and libc
comparison chart on the project website,

    http://www.etalabs.net/musl/

For installation instructions, see the INSTALL file.

Please refer to the COPYRIGHT file for details on the copyright status
of code included in musl, and the COPYING file for the license (LGPL)
under which the library as a whole is distributed.



Greetings libc hackers!

This package is an _alpha_ release of musl, intended for the curious
and the adventurous. While it can be used to build a complete small
Linux system (musl is self-hosted on the system I use to develop it),
at this point doing so requires a lot of manual effort. Nonetheless, I
hope low-level Linux enthusiasts will try out building some compact
static binaries with musl using the provided gcc wrapper (which allows
you to link programs with musl on a "standard" glibc Linux system),
find whatever embarassing bugs I've let slip through, and provide
feedback on issues encountered building various software against musl.

For bug reports, support requests, or to get involved in development,
please visit #musl on Freenode IRC or subscribe to the musl mailing
list by sending a blank email to musl-subscribe AT lists DOT openwall
DOT com.

Thank you for trying out musl.

Cheers,

Rich Felker / dalias