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

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

libbinder: O_CLOFORK

You can't use binder after forking, so we can drop the FD. The binder
driver doesn't support this (once the FD is open, we would need to
open a new context in the child process). So, the userspace API would
need to handle resetting all state. However, in general, handling this
for multi-threaded processes (because of needing to take all locks by
all libraries used by all threads and restoring state, etc...) is too
complicated to make work in Android.

Bug: 232904068
Test: binderLibTest
Change-Id: I38c354af2c69804a40dc2774086a9ab77d158ede
parent 97c1356a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -175,6 +175,10 @@ void ProcessState::childPostFork() {
    // the thread handler is installed
    if (gProcess) {
        gProcess->mForked = true;

        // "O_CLOFORK"
        close(gProcess->mDriverFD);
        gProcess->mDriverFD = -1;
    }
    gProcessMutex.unlock();
}