Skip to content

Commit d0503fa

Browse files
Merge "libbinder: allow fd transport in trusty by default" into main am: 4b89f17 am: cadcf50
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3503637 Change-Id: Id7c3fe4b90270da223854b6d5044a7d07af5d555 Signed-off-by: Automerger Merge Worker <[email protected]>
2 parents e6c3826 + cadcf50 commit d0503fa

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

libs/binder/trusty/include/binder/RpcServerTrusty.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ class RpcServerTrusty final : public virtual RefBase {
9494
static sp<RpcServer> makeRpcServer(std::unique_ptr<RpcTransportCtx> ctx) {
9595
auto rpcServer = sp<RpcServer>::make(std::move(ctx));
9696

97-
// TODO(b/266741352): follow-up to prevent needing this in the future
98-
// Trusty needs to be set to the latest stable version that is in prebuilts there.
99-
LOG_ALWAYS_FATAL_IF(!rpcServer->setProtocolVersion(0));
97+
// By default we use the latest stable version.
98+
LOG_ALWAYS_FATAL_IF(!rpcServer->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION));
10099

101100
return rpcServer;
102101
}

libs/binder/trusty/rust/binder_rpc_server_bindgen/cpp/ARpcServerTrusty.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ using android::RpcTransportCtxFactoryTipcTrusty;
2727
using android::sp;
2828
using android::wp;
2929

30+
// The default behavior in trusty is to allow handles to be passed with tipc IPC.
31+
// We add mode NONE so that servers do not reject connections from clients who do
32+
// not change their default transport mode.
33+
static const std::vector<RpcSession::FileDescriptorTransportMode> TRUSTY_SERVER_SUPPORTED_FD_MODES =
34+
{RpcSession::FileDescriptorTransportMode::TRUSTY,
35+
RpcSession::FileDescriptorTransportMode::NONE};
36+
3037
struct ARpcServerTrusty {
3138
sp<RpcServer> mRpcServer;
3239

@@ -53,6 +60,8 @@ ARpcServerTrusty* ARpcServerTrusty_newPerSession(AIBinder* (*cb)(const void*, si
5360
return nullptr;
5461
}
5562

63+
rpcServer->setSupportedFileDescriptorTransportModes(TRUSTY_SERVER_SUPPORTED_FD_MODES);
64+
5665
rpcServer->setPerSessionRootObject(
5766
[cb, cbArgSp](wp<RpcSession> /*session*/, const void* addrPtr, size_t len) {
5867
auto* aib = (*cb)(addrPtr, len, cbArgSp.get());

0 commit comments

Comments
 (0)