diff options
author | 2022-08-17 04:59:01 +0000 | |
---|---|---|
committer | 2022-10-05 02:16:09 +0000 | |
commit | 1c18a808397e283dc0bfce490fc890b07e5ab6bf (patch) | |
tree | 99201621a6db0cf314bfedda2cb9d925e09292cc /libs/binder/RpcState.cpp | |
parent | 54fa235236470c59a37f42552d228e7d78176038 (diff) |
libbinder: add ancillaryFd support in RpcTransportTipcTrusty
Implement ParcelFileDescriptor support in Trusty by
adding support for ancillaryFd to RpcTransportTipcTrusty.
Bug: 242940548
Test: Trusty tests
Change-Id: Ic5602bbf9f239f65489e0f411f89b10907741be3
Diffstat (limited to 'libs/binder/RpcState.cpp')
-rw-r--r-- | libs/binder/RpcState.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp index c411f4fed3..4d4830920c 100644 --- a/libs/binder/RpcState.cpp +++ b/libs/binder/RpcState.cpp @@ -56,6 +56,7 @@ static bool enableAncillaryFds(RpcSession::FileDescriptorTransportMode mode) { case RpcSession::FileDescriptorTransportMode::NONE: return false; case RpcSession::FileDescriptorTransportMode::UNIX: + case RpcSession::FileDescriptorTransportMode::TRUSTY: return true; } } @@ -1205,6 +1206,20 @@ status_t RpcState::validateParcel(const sp<RpcSession>& session, const Parcel& p rpcFields->mFds->size(), kMaxFdsPerMsg); return BAD_VALUE; } + break; + } + case RpcSession::FileDescriptorTransportMode::TRUSTY: { + // Keep this in sync with trusty_ipc.h!!! + // We could import that file here on Trusty, but it's not + // available on Android + constexpr size_t kMaxFdsPerMsg = 8; + if (rpcFields->mFds->size() > kMaxFdsPerMsg) { + *errorMsg = StringPrintf("Too many file descriptors in Parcel for Trusty " + "IPC connection: %zu (max is %zu)", + rpcFields->mFds->size(), kMaxFdsPerMsg); + return BAD_VALUE; + } + break; } } } |