diff options
author | 2019-08-08 15:41:01 -0700 | |
---|---|---|
committer | 2019-08-12 18:28:30 +0000 | |
commit | cfdeaf19e10b9401c43d61822ce91a9b5c4f7b52 (patch) | |
tree | fb67c3774ba6c01ee564d5921dc536efa76a5a09 | |
parent | 3f5fef583e5c01048a1a54471144eae71bf9025e (diff) |
libbinder: can't remark binder stability
Marking a binder should only ever happen by the AIDL compiler (where the
stability is tied to the build system and other API checks) or, for
existing hand-written binders, when they first leave the process.
In order to detect accidental mismarks of binders, it's a hard error.
Bug: 136027762
Test: binderStabilityTest
Change-Id: I8570300562b26c58da0ec872afbe130cac3d53bd
-rw-r--r-- | libs/binder/tests/binderStabilityTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/binder/tests/binderStabilityTest.cpp b/libs/binder/tests/binderStabilityTest.cpp index 490850ebf4..0336b9e3ab 100644 --- a/libs/binder/tests/binderStabilityTest.cpp +++ b/libs/binder/tests/binderStabilityTest.cpp @@ -275,6 +275,14 @@ TEST(BinderStability, MarkingObjectNoDestructTest) { ASSERT_TRUE(MarksStabilityInConstructor::gDestructed); } +TEST(BinderStability, RemarkDies) { + ASSERT_DEATH({ + sp<IBinder> binder = new BBinder(); + Stability::markCompilationUnit(binder.get()); // <-- only called for tests + Stability::markVndk(binder.get()); // <-- only called for tests + }, "Should only mark known object."); +} + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); |