Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9dd2e9c

Browse files
authored
[fuchsia] fdio_service_connect no longer provides rights which we need (#39374)
fdio_service_connect no longer provides rights. Since we need the READABLE right when opening the debug/ctrl/diagnostics directories, this change uses fdio_open_at. This change also fixes the Clone to remove specific rights and instead use CLONE_SAME_RIGHTS. Verified locally that we no longer get ACCESS_DENIED on the diagnostics directory when opening in component manager.
1 parent 2ddbff9 commit 9dd2e9c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

shell/platform/fuchsia/flutter/component_v1.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ ComponentV1::ComponentV1(
217217

218218
// Clone and check if client is servicing the directory.
219219
directory_ptr_->Clone(fuchsia::io::OpenFlags::DESCRIBE |
220-
fuchsia::io::OpenFlags::RIGHT_READABLE |
221-
fuchsia::io::OpenFlags::RIGHT_WRITABLE,
220+
fuchsia::io::OpenFlags::CLONE_SAME_RIGHTS,
222221
cloned_directory_ptr_.NewRequest());
223222

224223
cloned_directory_ptr_.events().OnOpen = [this](zx_status_t status,
@@ -234,8 +233,11 @@ ComponentV1::ComponentV1(
234233
for (auto& dir_str : other_dirs) {
235234
fuchsia::io::DirectoryHandle dir;
236235
auto request = dir.NewRequest().TakeChannel();
237-
auto status = fdio_service_connect_at(directory_ptr_.channel().get(),
238-
dir_str, request.release());
236+
auto status = fdio_open_at(
237+
directory_ptr_.channel().get(), dir_str,
238+
static_cast<uint32_t>(fuchsia::io::OpenFlags::DIRECTORY |
239+
fuchsia::io::OpenFlags::RIGHT_READABLE),
240+
request.release());
239241
if (status == ZX_OK) {
240242
outgoing_dir_->AddEntry(
241243
dir_str, std::make_unique<vfs::RemoteDir>(dir.TakeChannel()));

shell/platform/fuchsia/flutter/component_v2.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,7 @@ ComponentV2::ComponentV2(
267267

268268
// Clone and check if client is servicing the directory.
269269
directory_ptr_->Clone(fuchsia::io::OpenFlags::DESCRIBE |
270-
fuchsia::io::OpenFlags::RIGHT_READABLE |
271-
fuchsia::io::OpenFlags::RIGHT_WRITABLE,
270+
fuchsia::io::OpenFlags::CLONE_SAME_RIGHTS,
272271
cloned_directory_ptr_.NewRequest());
273272

274273
// Collect our standard set of directories along with directories that are
@@ -291,8 +290,11 @@ ComponentV2::ComponentV2(
291290
for (auto& dir_str : other_dirs) {
292291
fuchsia::io::DirectoryHandle dir;
293292
auto request = dir.NewRequest().TakeChannel();
294-
auto status = fdio_service_connect_at(directory_ptr_.channel().get(),
295-
dir_str.c_str(), request.release());
293+
auto status = fdio_open_at(
294+
directory_ptr_.channel().get(), dir_str.c_str(),
295+
static_cast<uint32_t>(fuchsia::io::OpenFlags::DIRECTORY |
296+
fuchsia::io::OpenFlags::RIGHT_READABLE),
297+
request.release());
296298
if (status == ZX_OK) {
297299
outgoing_dir_->AddEntry(
298300
dir_str.c_str(),

0 commit comments

Comments
 (0)