History log of /bionic/libc/bionic/dlmalloc.c
Revision Date Author Comments
7f4074d17d0e22e5e18e472c7e099490df8efaf2 08-Aug-2013 Colin Cross <ccross@android.com> bionic: name malloc'd regions

Use the new __bionic_name_mem function to name malloc'd memory as
"libc_malloc" on kernels that support it.

Change-Id: I7235eae6918fa107010039b9ab8b7cb362212272
61e699a133a4807fe878a6cb0d7190d7c96e21f8 12-Jun-2013 Elliott Hughes <enh@google.com> Clean up abort.

* A dlmalloc usage error shouldn't call abort(3) because we want to
cause a SIGSEGV by writing the address dlmalloc didn't like to an
address the kernel won't like, so that debuggerd will dump the
memory around the address that upset dlmalloc.

* Switch to the simpler FreeBSD/NetBSD style of registering stdio
cleanup. Hopefully this will let us simplify more of the stdio
implementation.

* Clear the stdio cleanup handler before we abort because of a dlmalloc
corruption error. This fixes the reported bug, where we'd hang inside
dlmalloc because the stdio cleanup reentered dlmalloc.

Bug: 9301265
Change-Id: Ief31b389455d6876e5a68f0f5429567d37277dbc
7b4d77e400d321ccc7cdadd1cd225ebb1a69d358 04-Apr-2013 Elliott Hughes <enh@google.com> Make abort messages available to debuggerd.

This adds __libc_fatal, cleans up the internal logging code a bit more,
and switches suitable callers over to __libc_fatal. In addition to logging,
__libc_fatal stashes the message somewhere that the debuggerd signal handler
can find it before calling abort.

In the debuggerd signal handler, we pass this address to debuggerd so that
it can come back with ptrace to read the message and present it to the user.

Bug: 8531731

(cherry picked from commit 0d787c1fa18c6a1f29ef9840e28a68cf077be1de)

Change-Id: I5daeeaa36c1fc23f7f437d73a19808d9d558dd4d
0d787c1fa18c6a1f29ef9840e28a68cf077be1de 04-Apr-2013 Elliott Hughes <enh@google.com> Make abort messages available to debuggerd.

This adds __libc_fatal, cleans up the internal logging code a bit more,
and switches suitable callers over to __libc_fatal. In addition to logging,
__libc_fatal stashes the message somewhere that the debuggerd signal handler
can find it before calling abort.

In the debuggerd signal handler, we pass this address to debuggerd so that
it can come back with ptrace to read the message and present it to the user.

Bug: 8531731
Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
1fe1137576a1b7faf2d9bede121cc6faeceb50ff 03-Apr-2013 Elliott Hughes <enh@google.com> Stop using unreasonable numbers of map entries.

(cherry-pick of 4ace92c62ada583b220836d76de2cfcb78d4d48d.)

Bug: 8460659
Change-Id: I1a9dc30cbf6a7a2c68cb3d8000921e9178eedb85
4ace92c62ada583b220836d76de2cfcb78d4d48d 03-Apr-2013 Elliott Hughes <enh@google.com> Stop using unreasonable numbers of map entries.

Bug: 8460659
Change-Id: Ib0ee71e3cf61e122d0449c9d8a4e4670a7d7129a
65a8eb606f2104f4b14514fa2a89d2867167793b 25-Mar-2013 Elliott Hughes <enh@google.com> Clarify the dlmalloc USAGE_ERROR.

Bug: 8468088
Change-Id: I1ff6d51ec17fc74ef56229aa76d2986cbd662874
8f2a5a0b40fc82126c691d5c30131d908772aab7 15-Mar-2013 Elliott Hughes <enh@google.com> Clean up internal libc logging.

We only need one logging API, and I prefer the one that does no
allocation and is thus safe to use in any context.

Also use O_CLOEXEC when opening the /dev/log files.

Move everything logging-related into one header file.

Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58
ce4cf90d7993ec7b9abc79bc86ede4d8758a49ab 22-Jan-2013 Elliott Hughes <enh@google.com> Use the new non-allocating logging for dlmalloc failures.

Change-Id: I88afe0201ee5766a295fc5a9e710fba9d6e0d363
8921060253f95fa77dbfe96ddaab5a39c446a49e 12-Jan-2013 Ian Rogers <irogers@google.com> Name anonymous mmap mallocs.

Change-Id: Icc53ba1eecb8445210623826d8e99a611d686f7f
2c344d3631eaad4bcfec821ea0e9f158c537a686 29-Aug-2012 Ian Rogers <irogers@google.com> Revert "Revert "Upgrade to dlmalloc 2.8.5.""

This reverts commit f72ee269274170cd46af2844a2fe88767fb6e43c.
561bf16be54de9a1387a2063a5609f925ccfb898 22-Aug-2012 Brian Carlstrom <bdc@google.com> Revert "Upgrade to dlmalloc 2.8.5."

This reverts commit 999089181ef60bb67e1a49f2cf6f4ec608a7caf8.
f72ee269274170cd46af2844a2fe88767fb6e43c 22-Aug-2012 Brian Carlstrom <bdc@google.com> Revert "Upgrade to dlmalloc 2.8.5."

This reverts commit 999089181ef60bb67e1a49f2cf6f4ec608a7caf8.
999089181ef60bb67e1a49f2cf6f4ec608a7caf8 18-Aug-2012 Ian Rogers <irogers@google.com> Upgrade to dlmalloc 2.8.5.

Move dlmalloc code to upstream-dlmalloc to make pulling upstream changes
easier.
Declare pvalloc and malloc_usable_size routines present in malloc.h but with
missing implementations. Remove other functions from malloc.h that have
no implementation nor use in Android.

Change-Id: Ia6472ec6cbebc9ad1ef99f4669de9d33fcc2efb4
ec2ab73b87bb0c6da24cfc86dbc2d79b9c923da1 19-Jun-2012 Ben Cheng <bccheng@google.com> Minor tweak to get memory around corrupted heap chunks dumped.

Change-Id: I8f72c5c7e23960b13fc53e2354cd74aca8aac3c0
2481468f2232b1d9670657e0148c434c3359ce19 25-May-2012 Ben Cheng <bccheng@google.com> Print the corrupted address passed to free().

For example:

@@@ ABORTING: INVALID HEAP ADDRESS IN dlfree addr=0x5c3bfbd0
Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 2942

The addr=0x5c3bfbd0 part is new.

Change-Id: I8670144b2b0a3a6182384150d762c97dfee5452f
c84ff11dad26435dc5760bceda18e8f1175a6061 25-May-2012 Ben Cheng <bccheng@google.com> Print the corrupted address passed to free().

For example:

@@@ ABORTING: INVALID HEAP ADDRESS IN dlfree addr=0x5c3bfbd0
Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 2942

The addr=0x5c3bfbd0 part is new.

Change-Id: I8670144b2b0a3a6182384150d762c97dfee5452f
6baffed252d0efbce5a79f356c2f156f4f818996 15-Dec-2011 Ken Sumrall <ksumrall@android.com> Add the posix_memalign(3) function to bionic

The posix_memalign(3) function is very similar to the traditional
memalign(3) function, but with better error reporting and a guarantee
that the memory it allocates can be freed. In bionic, memalign(3)
allocated memory can be freed, so posix_memalign(3) is just a wrapper
around memalign(3).

Change-Id: I62ee908aa5ba6b887d8446a00d8298d080a6a299
eaae81082cb76efa43a2c3fb57997b28ca270634 21-Mar-2012 Ben Cheng <bccheng@google.com> Initialize mspace->least_addr properly in the mmap path.

BUG: 6206963
Change-Id: Id2ab580246de50a4511b56a734a7bece98fb945c
85aad909560508410101c18c6ecc6633df39c596 15-Dec-2011 Ken Sumrall <ksumrall@android.com> Add the posix_memalign(3) function to bionic

The posix_memalign(3) function is very similar to the traditional
memalign(3) function, but with better error reporting and a guarantee
that the memory it allocates can be freed. In bionic, memalign(3)
allocated memory can be freed, so posix_memalign(3) is just a wrapper
around memalign(3).

Change-Id: I62ee908aa5ba6b887d8446a00d8298d080a6a299
c99376836021e6623516cf38d42259d38e1a480f 06-Jul-2011 Jean-Baptiste Queru <jbq@google.com> Revert "Revert "libc: Add logcat error message for memory corruption""

This reverts commit 368ee1e4d65c555fdb0fa4b3a91d75a397936908.
c51871d4b22425b32ec40c060c39d6b6fa4406f6 06-Jul-2011 David 'Digit' Turner <digit@android.com> Really fix the build.

libcutils/mspace.c includes libc/bionic/dlmalloc.c, we need to
take care of the fact that any internal C library function cannot
be used from it.

Change-Id: I0bc81ae090b7ac2d464f26b97fc6b94a08cdad9c
a4824467c33c5a59317f777a54c60e3b339e4966 06-Jul-2011 David 'Digit' Turner <digit@android.com> Fix broken build

Change-Id: Ia46b50aec51a55434c8828a73e07f4732f8f6c1c
368ee1e4d65c555fdb0fa4b3a91d75a397936908 06-Jul-2011 Mathew Inwood <mathewi@google.com> Revert "libc: Add logcat error message for memory corruption"

This fixes the build.

This reverts commit 7708a89c60e7b024d31c48c8034932c5e9f0aceb.
7708a89c60e7b024d31c48c8034932c5e9f0aceb 30-Jun-2011 David 'Digit' Turner <digit@android.com> libc: Add logcat error message for memory corruption

Our dlmalloc implementation currently calls abort() when it detects
that the heap is corrupted, or that an invalid pointer is passed to
one of its functions.

The only way to detect this is because abort() will force-fully
crash the current program with a magic fault address of '0xdeadbaad'.

However, this is not really well documented, and a frequent topic
on the android-ndk forum (among others).

This change makes our dlmalloc code dump a simple message to the
log just before the abort() call (and hence before the stack trace)
to better help identify the problem.

Change-Id: Iebf7eb7fe26463ecadfaca8f247d237edb441e3c
b74ceb25aae555570df64fa4d4076272733a9a20 17-Nov-2009 Vladimir Chtchetkine <vchtchetkine@google.com> Split libc_debug.so into two .so modules loaded on demand from libc.so

This change is intended to eliminate need to replace libc.so with libc_debug.so in order to enablememory allocation debugging.
This is also the first step towards implementing extended memoryallocation debugging using emulator's capabilities in monitoring memory access.
194d3fa048cf909ca592dd56fa538dc9cd3f5ddb 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
f30dae9cf452e4308a34450b2a48eb6602936976 26-May-2009 Barry Hayes <bhayes@google.com> Add mspace_merge_objects
1dc9e472e19acfe6dc7f41e429236e7eef7ceda1 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
1767f908af327fa388b1c66883760ad851267013 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution