1. 15 May, 2014 1 commit
    • Dmitriy Ivanov's avatar
      Register _cleanup function with atexit · 623b0d05
      Dmitriy Ivanov authored
       * Register cleanup function with atexit
         instead of calling it explicitly on
         exit()
       * abort() no longer calls _cleanup:
         Flushing stdio buffers on abort is no
         longer required by POSIX.
       * dlmalloc no longer need to reset cleanup
         (see above)
       * Upstream findfp.c makebuf.c setvbuf.cexit.c
         to openbsd versions.
      
      Bug: 14415367
      Change-Id: I277058852485a9d3dbb13e5c232db5f9948d78ac
      623b0d05
  2. 08 Aug, 2013 1 commit
    • Colin Cross's avatar
      bionic: name malloc'd regions · 7f4074d1
      Colin Cross authored
      Use the new __bionic_name_mem function to name malloc'd memory as
      "libc_malloc" on kernels that support it.
      
      Change-Id: I7235eae6918fa107010039b9ab8b7cb362212272
      7f4074d1
  3. 12 Jun, 2013 1 commit
    • Elliott Hughes's avatar
      Clean up abort. · 61e699a1
      Elliott Hughes authored
      * 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
      61e699a1
  4. 05 Apr, 2013 2 commits
    • Elliott Hughes's avatar
      Make abort messages available to debuggerd. · 7b4d77e4
      Elliott Hughes authored
      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 0d787c1f)
      
      Change-Id: I5daeeaa36c1fc23f7f437d73a19808d9d558dd4d
      7b4d77e4
    • Elliott Hughes's avatar
      Make abort messages available to debuggerd. · 0d787c1f
      Elliott Hughes authored
      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
      0d787c1f
  5. 03 Apr, 2013 2 commits
  6. 25 Mar, 2013 1 commit
  7. 15 Mar, 2013 1 commit
    • Elliott Hughes's avatar
      Clean up internal libc logging. · 8f2a5a0b
      Elliott Hughes authored
      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
      8f2a5a0b
  8. 22 Jan, 2013 1 commit
  9. 12 Jan, 2013 1 commit
  10. 28 Aug, 2012 1 commit
  11. 22 Aug, 2012 2 commits
  12. 20 Aug, 2012 1 commit
    • Ian Rogers's avatar
      Upgrade to dlmalloc 2.8.5. · 99908918
      Ian Rogers authored
      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
      99908918
  13. 19 Jun, 2012 1 commit
  14. 25 May, 2012 2 commits
    • Ben Cheng's avatar
      Print the corrupted address passed to free(). · 2481468f
      Ben Cheng authored
      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
      2481468f
    • Ben Cheng's avatar
      Print the corrupted address passed to free(). · c84ff11d
      Ben Cheng authored
      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
      c84ff11d
  15. 27 Apr, 2012 1 commit
    • Ken Sumrall's avatar
      Add the posix_memalign(3) function to bionic · 6baffed2
      Ken Sumrall authored
      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
      6baffed2
  16. 21 Mar, 2012 1 commit
  17. 15 Dec, 2011 1 commit
    • Ken Sumrall's avatar
      Add the posix_memalign(3) function to bionic · 85aad909
      Ken Sumrall authored
      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
      85aad909
  18. 06 Jul, 2011 4 commits
  19. 05 Jul, 2011 1 commit
    • David 'Digit' Turner's avatar
      libc: Add logcat error message for memory corruption · 7708a89c
      David 'Digit' Turner authored
      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
      7708a89c
  20. 18 Nov, 2009 1 commit
  21. 13 Nov, 2009 1 commit
  22. 02 Jun, 2009 1 commit
  23. 04 Mar, 2009 2 commits
  24. 21 Oct, 2008 1 commit