diff options
author | 2022-10-07 03:52:32 +0000 | |
---|---|---|
committer | 2022-10-07 03:52:32 +0000 | |
commit | 8eb983cefaa6981865017dc6c9a6879e2145b1f5 (patch) | |
tree | de73a450cc2b49b21e055e08b926816503ef9b2d /libs/binder/RpcState.cpp | |
parent | 75bae5e33d8cc841620ccc4208984b06c051ce90 (diff) | |
parent | 1c18a808397e283dc0bfce490fc890b07e5ab6bf (diff) |
Merge "libbinder: add ancillaryFd support in RpcTransportTipcTrusty"
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 7067328358..b27f1028d4 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; } } @@ -1207,6 +1208,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; } } } |