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

Commit 49c27535 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder: avoid ACCEPT_FDS on proxies

Setting to accept FDs only makes sense on a local binder. Sending
out a proxy binder will always give a reference to a binder in the
original process.

Bug: N/A
Test: binderLibTest, boot
Change-Id: I7fe653228580274a82af5a24b9cb6ccdfb9ebac6
parent 0f899ce8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -200,7 +200,6 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) {
    }

    flat_binder_object obj;
    obj.flags = FLAT_BINDER_FLAG_ACCEPTS_FDS;

    int schedBits = 0;
    if (!IPCThreadState::self()->backgroundSchedulingDisabled()) {
@@ -221,6 +220,7 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) {
            const int32_t handle = proxy ? proxy->getPrivateAccessor().binderHandle() : 0;
            obj.hdr.type = BINDER_TYPE_HANDLE;
            obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */
            obj.flags = 0;
            obj.handle = handle;
            obj.cookie = 0;
        } else {
@@ -231,6 +231,7 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) {
                // override value, since it is set explicitly
                schedBits = schedPolicyMask(policy, priority);
            }
            obj.flags = FLAT_BINDER_FLAG_ACCEPTS_FDS;
            if (local->isRequestingSid()) {
                obj.flags |= FLAT_BINDER_FLAG_TXN_SECURITY_CTX;
            }
@@ -243,6 +244,7 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) {
        }
    } else {
        obj.hdr.type = BINDER_TYPE_BINDER;
        obj.flags = 0;
        obj.binder = 0;
        obj.cookie = 0;
    }