Commit graph

3 commits

Author SHA1 Message Date
Josh Gao
7266e91f62 Move unique_fd fdsan tests into bionic.
EXPECT_DEATH requires special handling to work with fdsan, because of
our fork detection. Instead of duplicating the EXPECT_FDSAN_DEATH macro
in the libbase tests as well, move the unique_fd fdsan tests here.

Test: bionic_unit_tests
Change-Id: Ia7b65d4560601d5a78d143aced887a6773b401c0
2018-08-09 01:09:08 +00: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
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