Commit graph

12 commits

Author SHA1 Message Date
Josh Gao
f5693c688d Generalize abort's inline_tgkill, use it in fdsan.
Convert abort's inline_tgkill to do the equivalent of
pthread_sigqueue(pthread_self(), ...), so that we can use it in fdsan
as well.

Test: bionic-unit-tests
Test: debuggerd_test32
Test: debuggerd_test64
Change-Id: I92a7b84e2f00ce021b4043ed8a3bd8683d77fe9c
2018-08-31 16:39:23 -07:00
Josh Gao
ab6a0802af fdsan: add type for ART's FdFile.
Bug: http://b/113558485
Test: none
Change-Id: I9bc874d8689cc54563f2a5878d324b27ad85060e
2018-08-30 17:37:52 -07:00
Josh Gao
be66a06412 fdsan: provide abort message in warning tombstones.
Bug: http://b/112770187
Test: debuggerd_test
Test: bionic-unit-tests
Test: crasher fdsan_file
Change-Id: I55e18eafaee8b0c35bacd2795b7830bcb9d59291
2018-08-27 16:48:17 -07:00
Josh Gao
b6b3a1d4f9 fdsan: expose functions to get and interpret tags.
Make it easier to write tests in users of fdsan by exposing functions
to allow users to get and interpret the tags.

Test: bionic_unit_tests
Change-Id: Iafa9bcaeb5e4db230f3dfec6f483274f34602694
2018-08-23 23:10:52 -07:00
Josh Gao
27cc4bc414 Add fdsan owner type for sqlite.
Test: none
Change-Id: Ib331d108e7e0431250eba3609f3557d8e4665aba
2018-08-23 23:10:52 -07:00
George Burgess IV
fa5410fdb7 libc: enable -Wimplicit-fallthrough
libc had some -Wimplicit-fallthrough warnings. They all seem to be
benign. We're trying to enable this flag globally, so we need to
annotate these breaks here.

Bug: 112564944
Test: Builds
Change-Id: I5afae694cc4cf26ad1a61e2c8ae91f00cda7c733
2018-08-15 10:11:08 -07:00
Josh Gao
e16082f717 fdsan: expose the address of the table to the platform.
Let the debuggerd handler get the address of the fdsan table so that
crash_dump can parse it and print it out in tombstones.

Test: debuggerd `pidof adbd`
Change-Id: I2297200cae52d0ff24479dba55d1ab4938583501
2018-08-06 18:48:52 -07:00
Josh Gao
e6dab7b55f fdsan: minor refactoring.
Make it easier for other code to parse the fdsan table themselves by
making it so that they can include the bionic_fdsan.h header to get a
struct definition with the layout without bringing in other
dependencies.

Test: treehugger
Change-Id: I3583ef113991234aa83cd193a4eb139ad06737c7
2018-08-06 18:47:29 -07:00
Josh Gao
4b7c1cc13f fdsan: enable by default.
Test: adb shell crasher fdsan_file
Change-Id: I6be0f7372ddb9d622a0bd8d1eeb80a4f747c99e3
2018-08-06 15:11:08 -07:00
Josh Gao
08b7a4008f fdsan: improve errors some more.
Add handling for all 4 cases of failure of exchange_owner_tag. Also,
mask off and sign extend the type byte of the owner tag, and add a
test for that.

Test: bionic_unit_tests
Change-Id: Ic7c49f0ee5498623f05c49b5b4cd055db48a4b9f
2018-08-03 15:03:41 -07:00
Josh Gao
fe380887c8 fdsan: improve diagnostics.
Generate a tombstone instead of just a log message when warning. Also,
don't use async_safe_fatal_va_list when we're not calling abort, as
this will permanently set the abort message.

Test: bionic_unit_tests
Test: setprop debug.fdsan warn; crasher fdsan_file
Change-Id: I2fe271da9004c8fd1f50ad3d8280be254eeaf656
2018-07-23 18:36:16 -07:00
Josh Gao
f6e5b58260 Introduce api to track fd ownership in libc.
Add two functions to allow objects that own a file descriptor to
enforce that only they can close their file descriptor.

Use them in FILE* and DIR*.

Bug: http://b/110100358
Test: bionic_unit_tests
Test: aosp/master boots without errors
Test: treehugger
Change-Id: Iecd6e8b26c62217271e0822dc3d2d7888b091a45
2018-07-19 14:28:54 -07:00