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

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

libbinder: RPC avoid FdTrigger shutdown race

RpcSession's FdTrigger can't have simultaneous calls to trigger. This
will cause a double-close of the FD. Take locks to avoid this case.

Bug: 200368820
Test: binderRpcTest, binder_rpc_fuzzer, binder_bpBinderFuzz
Change-Id: I94822f441142b3a1352e38adacb8e17f285d66ac
parent 10717131
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -205,8 +205,11 @@ bool RpcServer::shutdown() {
    }

    mShutdownTrigger->trigger();

    for (auto& [id, session] : mSessions) {
        (void)id;
        // server lock is a more general lock
        std::lock_guard<std::mutex> _lSession(session->mMutex);
        session->mShutdownTrigger->trigger();
    }