diff options
author | 2025-03-07 06:41:42 -0800 | |
---|---|---|
committer | 2025-03-07 06:41:42 -0800 | |
commit | cadcf50fd804adb2765fd622c3d23589138d5a42 (patch) | |
tree | 2d698f7db968ce5ebb03271b94a7488e3bfdd239 /libs/binder | |
parent | 797caaffdfb52b5bda5daddc58d2d1849153603b (diff) | |
parent | 4b89f17ef1ba81b6822607760d1a83d069bf8533 (diff) |
Merge "libbinder: allow fd transport in trusty by default" into main am: 4b89f17ef1
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3503637
Change-Id: I1d2460cae9ec6224e496ef10d7271f71d3ce2db2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'libs/binder')
-rw-r--r-- | libs/binder/trusty/include/binder/RpcServerTrusty.h | 5 | ||||
-rw-r--r-- | libs/binder/trusty/rust/binder_rpc_server_bindgen/cpp/ARpcServerTrusty.cpp | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/libs/binder/trusty/include/binder/RpcServerTrusty.h b/libs/binder/trusty/include/binder/RpcServerTrusty.h index 583ad015e1..127676bf9a 100644 --- a/libs/binder/trusty/include/binder/RpcServerTrusty.h +++ b/libs/binder/trusty/include/binder/RpcServerTrusty.h @@ -94,9 +94,8 @@ private: static sp<RpcServer> makeRpcServer(std::unique_ptr<RpcTransportCtx> ctx) { auto rpcServer = sp<RpcServer>::make(std::move(ctx)); - // TODO(b/266741352): follow-up to prevent needing this in the future - // Trusty needs to be set to the latest stable version that is in prebuilts there. - LOG_ALWAYS_FATAL_IF(!rpcServer->setProtocolVersion(0)); + // By default we use the latest stable version. + LOG_ALWAYS_FATAL_IF(!rpcServer->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION)); return rpcServer; } diff --git a/libs/binder/trusty/rust/binder_rpc_server_bindgen/cpp/ARpcServerTrusty.cpp b/libs/binder/trusty/rust/binder_rpc_server_bindgen/cpp/ARpcServerTrusty.cpp index 451383a90a..12e347e4f3 100644 --- a/libs/binder/trusty/rust/binder_rpc_server_bindgen/cpp/ARpcServerTrusty.cpp +++ b/libs/binder/trusty/rust/binder_rpc_server_bindgen/cpp/ARpcServerTrusty.cpp @@ -27,6 +27,13 @@ using android::RpcTransportCtxFactoryTipcTrusty; using android::sp; using android::wp; +// The default behavior in trusty is to allow handles to be passed with tipc IPC. +// We add mode NONE so that servers do not reject connections from clients who do +// not change their default transport mode. +static const std::vector<RpcSession::FileDescriptorTransportMode> TRUSTY_SERVER_SUPPORTED_FD_MODES = + {RpcSession::FileDescriptorTransportMode::TRUSTY, + RpcSession::FileDescriptorTransportMode::NONE}; + struct ARpcServerTrusty { sp<RpcServer> mRpcServer; @@ -53,6 +60,8 @@ ARpcServerTrusty* ARpcServerTrusty_newPerSession(AIBinder* (*cb)(const void*, si return nullptr; } + rpcServer->setSupportedFileDescriptorTransportModes(TRUSTY_SERVER_SUPPORTED_FD_MODES); + rpcServer->setPerSessionRootObject( [cb, cbArgSp](wp<RpcSession> /*session*/, const void* addrPtr, size_t len) { auto* aib = (*cb)(addrPtr, len, cbArgSp.get()); |