Commit graph

15 commits

Author SHA1 Message Date
Christopher Ferris
e2f58a3f03 Use AndroidLocalUnwinder object.
Using the AndroidLocalUnwinder object allows unwinding interpreter
and JIT'd frames by default. In addition, it simplifies the code.

Test: Forced interpreter on all of the time and forced fdtrack on
Test: and verified unwind includes dex frames.
Test: Forced JIT on all of the time and forced fdtrack on
Test: and verified unwind includes dex frames.
Test: Unit tests pass.
Change-Id: Icae17e83c9aaa04750b07471243550a7829524f7
2023-05-17 18:45:25 -07:00
Elliott Hughes
263faa90e1 Ignore ART frames in fdtrack traces.
Trying to find a leak this year, it was very annoying that our traces
were mostly filled with "junk" frames from the JNI implementation,
making it quite a struggle to see what the actual calling code was...

Bug: http://b/236197847
Test: treehugger
Change-Id: I69e7d9b6432e1872e238168ebf3dc36feb7de7df
2022-12-12 21:41:51 +00:00
Christopher Ferris
459eecb28b Update for LocalUnwinder object removal.
Modify libfdtrack to use the normal Unwinder object. In addition,
update the libfdtrack so that it doesn't record frames in
libfdtrack.so rather than skipping frames it thinks will be in
the library.

Modify the malloc debug code to use the normal Unwinder object.

Bug: 120606663

Test: All unit tests pass.
Change-Id: I3c9612dd10e62389e6219e68045ee87f7b2625f5
2022-03-03 15:23:25 -08:00
Josh Gao
dcc97c0887 Disable fdtrack post-fork.
Also delete some fdsan code that attempts to check for the post-fork
state, but never will, because we update the cached pid upon fork.

Bug: http://b/174542867
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Test: treehugger
Change-Id: I9b748dac9de9b4c741897d93e64d31737e52bf8e
2021-04-07 19:00:45 -07:00
Josh Gao
1cb3681335 fdtrack: emit the most common stack in the abort message.
Bug: http://b/181875562
Test: manual
Change-Id: I2826b148d55788e932fa04dcef33c78fad8be227
2021-03-15 15:55:06 -07:00
Bob Badour
aa7d835fdd Add LOCAL_LICENSE_KINDS to bionic
Added SPDX-license-identifier-Apache-2.0 to:
  apex/Android.bp
  libdl/Android.bp
  tools/Android.bp
  tools/versioner/Android.bp
  tools/versioner/src/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  benchmarks/Android.bp
  benchmarks/linker_relocation/gen/Android.bp
  libc/malloc_debug/Android.bp
  libc/system_properties/Android.bp
  tests/Android.bp
  tests/libs/Android.bp
  tests/libs/Android.build.dlext_testzip.mk
  tests/make_fortify_compile_test.mk

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-ISC SPDX-license-identifier-MIT
    legacy_notice legacy_unencumbered
to:
  libc/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT legacy_unencumbered
to:
  libm/Android.bp

Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered
to:
  libc/tools/Android.bp

Added SPDX-license-identifier-BSD
to:
  benchmarks/linker_relocation/Android.bp
  benchmarks/spawn/Android.bp
  libc/async_safe/Android.bp
  libc/malloc_hooks/Android.bp
  libfdtrack/Android.bp
  linker/Android.bp
  tests/headers/Android.bp
  tests/headers/posix/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Exempt-From-Owner-Approval: janitorial work
Change-Id: Ib05bcaa276b3aa71a7654ccbe8e67e1f16aec9f3
2021-02-19 23:38:28 +00:00
Elliott Hughes
aa8db1b9d1 Fix/update notices.
Auto-generate NOTICE files for all the directories, and for each one
individually rather than mixing libc and libm together.

Test: N/A
Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
2021-02-16 15:06:50 -08:00
Josh Gao
55b91af828 fdtrack: increase backtrace depth.
Bug: http://b/155136951
Bug: http://b/157789860
Test: treehugger
Change-Id: I1e575fdef7d520f5a896130844eefb1a1ba46694
2020-06-02 16:06:55 -07:00
Josh Gao
38d00b80a0 fdtrack: don't destroy traces.
There's a bad interaction with malloc_debug when the libraries are being
destroyed.

Bug: https://issuetracker.google.com/154439915
Test: treehugger
Change-Id: Ib47c8139c3a88dd52865ea93654b2926bd708729
2020-04-29 17:20:24 -07:00
Yuxian Xu
3a5ddd72c3 libfdtrack: When dump fdsan fd owner, happen NE
When dump fdsan fd owner, happen NE. This because the format specifier
flag '#' is not supported by Bionic out_vformat<BufferOutputStream>.

Bug: 153611483
Test: jmgao@ verified manually
Change-Id: I7191c3b2b621ddcc0397874f8a69391e58232ac8
2020-04-09 12:46:58 -07:00
Josh Gao
ad8f02d780 fdtrack: add a test.
Test: logcat -c; fdtrack_test; logcat -d | grep fdtrack
Change-Id: Ie1101c9cf968299ec1f03f20097a2ed27f6e15bd
2020-02-03 14:29:52 -08:00
Josh Gao
6f08866e33 fdtrack: print fdsan owner tag.
Test: logcat -c; fdtrack_test; logcat -d | grep fdtrack
Change-Id: I0a7e342da239a0e7889eb228a3a023268d40b1c5
2020-01-30 13:55:11 -08:00
Josh Gao
50955c461b fdtrack: make actually async safe.
Test: setprop persist.sys.debug.fdtrack_enable_threshold; stop; start; logcat -c; killall -39 system_server; logcat -d | grep fdtrack
Change-Id: Id9baa54af9e5cfb6e1ee1026f71d7fb41b7c3ad0
2020-01-30 13:55:11 -08:00
Josh Gao
7596250722 Move fdtrack APIs to LLNDK.
Test: logcat -c; fdtrack_test; logcat -d
Change-Id: Ib6f75a7c8bbc4d6efa0708dcbbfe4ad3c0641022
2020-01-30 13:55:10 -08:00
Josh Gao
97271920bf Add a tool to track down fd leaks.
Add a hook that's called upon file descriptor creation to libc, and a
library that uses it to capture backtraces for file descriptor creation,
to make it easier to hunt down file descriptor leaks.

Currently, this doesn't capture all of the ways of creating a file
descriptor, but completeness isn't required for this to be useful as
long as leaked file descriptors are created with a function that is
tracked. The primary unhandled case is binder, which receives file
descriptors as a payload in a not-trivially-parsable byte blob, but
there's a chance that the leak we're currently trying to track down
isn't of a file descriptor received over binder, so leave that for
later.

Bug: http://b/140703823
Test: manual
Change-Id: I308a14c2e234cdba4207157b634ab6b8bc539dd9
(cherry picked from commit b7eccd4b15)
2020-01-30 13:55:10 -08:00