musl - an implementation of the standard library for Linux-based systems
Go to file
Rich Felker 70a92bc968 fix heap corruption bug in memalign
this bug was caught by the new footer-corruption check in realloc and
free.

if the block returned by malloc was already aligned to the desired
alignment, memalign's logic to split off the misaligned head was
incorrect; rather than writing to a point inside the allocated block,
it was overwriting the footer of the previous block on the heap with
the value 1 (length 0 plus an in-use flag).

fortunately, the impact of this bug was fairly low. (this is probably
why it was not caught sooner.) due to the way the heap works, malloc
will never return a block whose previous block is free. (doing so would
be harmful because it would increase fragmentation with no benefit.)
the footer is actually not needed for in-use blocks, except that its
in-use bit needs to remain set so that it does not get merged with
free blocks, so there was no harm in it being set to 1 instead of the
correct value.

however, there is one case where this bug could have had an impact: in
multi-threaded programs, if another thread freed the previous block
after memalign's call to malloc returned, but before memalign
overwrote the previous block's footer, the resulting block in the free
list could be left in a corrupt state. I have not analyzed the impact
of this bad state and whether it could lead to more serious
malfunction.
2013-07-23 23:18:49 -04:00
arch remove SIG_ATOMIC_MIN/MAX from stdint bits headers 2013-07-22 17:02:03 -04:00
crt remove init/fini array asm from arm crti/crtn files 2013-07-21 03:48:35 -04:00
dist add another example option to dist/config.mak 2012-04-24 16:49:11 -04:00
include undefine internal-use type macros at the end of alltypes.h 2013-07-22 20:58:04 -04:00
lib new solution for empty lib dir (old one had some problems) 2011-02-17 17:12:52 -05:00
src fix heap corruption bug in memalign 2013-07-23 23:18:49 -04:00
tools refactor headers, especially alltypes.h, and improve C++ ABI compat 2013-07-22 11:22:36 -04:00
.gitignore new gcc wrapper, entirely specfile based 2012-04-22 14:32:49 -04:00
configure enhance build process to allow selective -O3 optimization 2013-07-22 21:22:04 -04:00
COPYRIGHT mention bits headers in another part of copyright file 2013-04-20 14:03:12 -04:00
INSTALL update readme and release notes for 0.9.8 2012-11-26 21:01:30 -05:00
Makefile enhance build process to allow selective -O3 optimization 2013-07-22 21:22:04 -04:00
README update documentation 2012-10-26 20:14:19 -04:00
WHATSNEW release notes for 0.9.11 2013-06-29 22:43:05 -04:00

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.musl-libc.org/

For installation instructions, see the INSTALL file.

Please refer to the COPYRIGHT file for details on the copyright and
license status of code included in musl (standard MIT license).



Greetings!

The 0.9.x release series for musl features interface coverage for all
interfaces defined in ISO C99 and POSIX 2008 base, along with a number
of non-standardized interfaces for compatibility with Linux, BSD, and
glibc functionality. As the release series progresses, we are
gradually adding support for incomplete functionality in existing
interfaces, additional functions that are deemed to be important due
to their use in real-world software, and support for new library and
language features in C11 such as thread-local storage, which is now
supported on all targets. In addition, support for additional target
cpu architectures is being added.

The number of packages build successfully against musl - either
out-of-the-box or with minor patches to address portability errors -
has exceeded 5000 and is steadily growing. In addition to application
compatibility testing, unit testing has been conducted using three
separate test frameworks and numerous additional standalone test cases
to verify the correctness of the implementation.

Included with this package is a gcc wrapper script (musl-gcc) which
allows you to build musl-linked programs using an existing gcc 3.x or
4.x toolchain on the host. There are also now at several mini
distributions (in the form of build scripts) which provide a
self-hosting musl-based toolchain and system root. These are much
better options than the wrapper script if you wish to use dynamic
linking or build packages with many library dependencies. See the musl
website for details.

The musl project is actively seeking contributors, mostly in the areas
of porting, testing, and application compatibility improvement. 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 using musl.

Cheers,

Rich Felker / dalias