1. 12 Jul, 2012 1 commit
  2. 02 Jul, 2012 1 commit
    • Andrew Hsieh's avatar
      Unhide rtld_db_dlactivity() · 40e7ed58
      Andrew Hsieh authored
      Since linker is built with -fvisibility=hidden rtld_db_dlactivity()
      if hidden from gdb.  Unhide it otherwise gdb may not know linker
      activity and rescan solib
      
      Change-Id: Ia8cd8d9738c6ea5696ba2ef0ebf2cf783f9ca70a
      40e7ed58
  3. 20 Jun, 2012 1 commit
  4. 19 Jun, 2012 2 commits
  5. 11 Jun, 2012 1 commit
  6. 06 Jun, 2012 1 commit
  7. 03 Jun, 2012 1 commit
  8. 01 Jun, 2012 1 commit
    • Iliyan Malchev's avatar
      bionic: import heaptracker as chk_malloc · e1dd3c28
      Iliyan Malchev authored
      
      This patch is a rewrite of libc.debug.malloc = 10 (chk_malloc).  It provides
      the same features as the original (poison freed memory, detect heap overruns
      and underruns), except that it provides more debugging information whenever it
      detects a problem.
      
      In addition to the original features, the new chk_malloc() implementation
      detects multiple frees within a given range of the last N allocations, N being
      configurable via the system property libc.debug.malloc.backlog.
      
      Finally, this patch keeps track of all outstanding memory allocations.  On
      program exit, we walk that list and report each outstanding allocation.
      
      (There is support (not enabled) for a scanner thread periodically walks over
      the list of outstanding allocations as well as the backlog of recently-freed
      allocations, checking for heap-usage errors.)
      
      Feature overview:
      
        1) memory leaks
        2) multiple frees
        3) use after free
        4) overrun
      
      Implementation:
      
      -- for each allocation, there is a:
        1) stack trace at the time the allocation is made
        2) if the memory is freed, there is also a stack trace at the point
        3) a front and rear guard (fence)
        4) the stack traces are kept together with the allocation
      
      -- the following lists and maintained
      
        1) all outstanding memory allocations
        3) a backlog of allocations what are freed; when you call free(), instead of
           actually freed, the allocation is moved to this backlog;
        4) when the backlog of allocations gets full, the oldest entry gets evicted
           from it; at that point, the allocation is checked for overruns or
           use-after-free errors, and then actually freed.
        5) when the program exits, the list of outstanding allocations and the
           backlog are inspected for errors, then freed;
      
      To use this, set the following system properties before running the process or
      processes you want to inspect:
      
      libc.malloc.debug.backlog # defaults to 100
      libc.malloc.debug 10
      
      When a problem is detected, you will see the following on logcat for a multiple
      free:
      
      E/libc    ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 BYTES MULTIPLY FREED!
      E/libc    ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 ALLOCATED HERE:
      E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #01  pc 0000c658  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #02  pc 00016d80  /system/lib/libc.so
      E/libc    ( 7233):      #03  pc 4009647c  /system/bin/malloctest
      E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
      E/libc    ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 FIRST FREED HERE:
      E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #01  pc 0000c7d2  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #02  pc 00016d94  /system/lib/libc.so
      E/libc    ( 7233):      #03  pc 40096490  /system/bin/malloctest
      E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
      E/libc    ( 7233): +++ ALLOCATION 0x404b9278 SIZE 10 NOW BEING FREED HERE:
      E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #01  pc 0000c6ac  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #02  pc 00016d94  /system/lib/libc.so
      E/libc    ( 7233):      #03  pc 400964a0  /system/bin/malloctest
      E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
      
      The following for a heap overrun and underrun:
      
      E/libc    ( 7233): +++ REAR GUARD MISMATCH [10, 11)
      E/libc    ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 HAS A CORRUPTED REAR GUARD
      E/libc    ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 ALLOCATED HERE:
      E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #01  pc 0000c658  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #02  pc 00016d80  /system/lib/libc.so
      E/libc    ( 7233):      #03  pc 40096438  /system/bin/malloctest
      E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
      E/libc    ( 7233): +++ ALLOCATION 0x404b9198 SIZE 10 FREED HERE:
      E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #01  pc 0000c7d2  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #02  pc 00016d94  /system/lib/libc.so
      E/libc    ( 7233):      #03  pc 40096462  /system/bin/malloctest
      E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
      E/libc    ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 HAS A CORRUPTED FRONT GUARD
      E/libc    ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 ALLOCATED HERE:
      E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #01  pc 0000c658  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #02  pc 00016d80  /system/lib/libc.so
      E/libc    ( 7233):      #03  pc 400964ba  /system/bin/malloctest
      E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
      E/libc    ( 7233): +++ ALLOCATION 0x404b9358 SIZE 10 FREED HERE:
      E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #01  pc 0000c7d2  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #02  pc 00016d94  /system/lib/libc.so
      E/libc    ( 7233):      #03  pc 400964e4  /system/bin/malloctest
      E/libc    ( 7233):      #04  pc 00016f24  /system/lib/libc.so
      
      The following for a memory leak:
      
      E/libc    ( 7233): +++ THERE ARE 1 LEAKED ALLOCATIONS
      E/libc    ( 7233): +++ DELETING 4096 BYTES OF LEAKED MEMORY AT 0x404b95e8 (1 REMAINING)
      E/libc    ( 7233): +++ ALLOCATION 0x404b95e8 SIZE 4096 ALLOCATED HERE:
      E/libc    ( 7233): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
      E/libc    ( 7233):      #00  pc 0000c35a  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #01  pc 0000c658  /system/lib/libc_malloc_debug_leak.so
      E/libc    ( 7233):      #02  pc 00016d80  /system/lib/libc.so
      E/libc    ( 7233):      #03  pc 0001bc94  /system/lib/libc.so
      E/libc    ( 7233):      #04  pc 0001edf6  /system/lib/libc.so
      E/libc    ( 7233):      #05  pc 0001b80a  /system/lib/libc.so
      E/libc    ( 7233):      #06  pc 0001c086  /system/lib/libc.so
      E/libc    ( 7233):      #07  pc 40096402  /system/bin/malloctest
      E/libc    ( 7233):      #08  pc 00016f24  /system/lib/libc.so
      
      Change-Id: Ic440e9d05a01e2ea86b25e8998714e88bc2d16e0
      Signed-off-by: default avatarIliyan Malchev <malchev@google.com>
      e1dd3c28
  9. 31 May, 2012 1 commit
  10. 30 May, 2012 2 commits
    • Iliyan Malchev's avatar
      bionic: introduce libc.debug.malloc.program · 7d2e24eb
      Iliyan Malchev authored
      
      libc.debug.malloc.program  provides an additional level of control over which
      processes to enable libc.debug.malloc functionality for.  The string value of
      libc.debug.malloc.program is matched against the program name; if the value of
      libc.debug.malloc.program is a substring of the program name, then malloc debug
      is applied to that program at whatever level libc.debug.malloc specifies.
      
      If lib.debug.malloc.program is not specified, then libc.debug.malloc has the
      same effect as before.
      
      For example, to enable libc.deubug.malloc = 10 only to the mediaserver, do the
      following:
      
         adb root # necessary for setprop
         adb setprop libc.debug.malloc.program mediaserver
         adb setprop libc.debug.malloc 10
         adb kill -9 $(pid mediaserver)
      
      Change-Id: I6f01c12f033c8e2e015d73025369d7f1685ba200
      Signed-off-by: default avatarIliyan Malchev <malchev@google.com>
      7d2e24eb
    • Geremy Condra's avatar
  11. 25 May, 2012 1 commit
    • 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
  12. 24 May, 2012 2 commits
  13. 10 May, 2012 1 commit
  14. 09 May, 2012 2 commits
  15. 08 May, 2012 1 commit
    • Ben Cheng's avatar
      Implement the "abort" stub in assembly for ARM. · 08b51e2c
      Ben Cheng authored
      So that we can always get the full stack trace regardless of gcc's handling
      of the "noreturn" attribute associated with abort().
      
      [cherry-picked from master]
      
      BUG:6455193
      Change-Id: I0102355f5bf20e636d3feab9d1424495f38e39e2
      08b51e2c
  16. 30 Apr, 2012 1 commit
  17. 26 Apr, 2012 2 commits
    • Mike Lockwood's avatar
      efcf8893
    • Nick Kralevich's avatar
      libc: continue to use Android's custom linker script · b091dd9b
      Nick Kralevich authored
      By default, Android no longer compiles code using it's custom
      linker script /build/core/armelf.xsc. However, this causes
      problems for libc. Certain programs linked using older versions
      of GOLD expect libc.so to export __exidx_start and __exidx_end.
      Removing the custom linker script causes libc.so not to export
      those symbols.
      
      For now, continue using the old linker script, until we can
      figure out a better solution.
      
      Change-Id: Iaf002afd63a58b848818da24e5a4525620dc4d74
      b091dd9b
  18. 25 Apr, 2012 2 commits
  19. 23 Apr, 2012 1 commit
    • Nick Kralevich's avatar
      linker: remove STB_LOCAL hack · 94179a50
      Nick Kralevich authored
      The ARM static linker wasn't properly handling __exidx_start
      and __exidx_end symbols. Now that the static linker has been fixed,
      we don't need the dynamic linker to work around this problem.
      
      Change-Id: I041b94903609fafab33663a7d441a5e70b7ffcdd
      94179a50
  20. 19 Apr, 2012 1 commit
  21. 18 Apr, 2012 4 commits
  22. 17 Apr, 2012 1 commit
  23. 16 Apr, 2012 9 commits