Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cfdeaf19 authored by Steven Moreland's avatar Steven Moreland
Browse files

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
parent 3f5fef58
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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);