Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Issue 3007703002: [dart:io] Namespaces for file IO (Closed)

Created:
3 years, 3 months ago by zra
Modified:
3 years, 3 months ago
Reviewers:
rmacnak, siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

[dart:io] Namespaces for file IO Fuchsia requires the ability to sandbox Isolates w.r.t. file IO. When a new Isolate starts, Fuchsia will pass the Isolate an object called a namespace. We can translate the namespace object into a file descriptor suitable for passing to the *at() family of POSIX file system calls. The file system calls will then have visibility only into the specified namespace. We also plumb Namespaces through on all the other platforms as well to make the change easier to test and so that in the future we can implement e.g. per-isolate cwds. This change adds a new internal class to dart:io called _Namespace, which is implemented in a patch file. See: sdk/lib/io/namespace_impl.dart runtime/bin/namespace_patch.dart The embedder can set up a non-default namespace by calling _Namespace._setupNamespace during Isolate setup. Instances of _Namespace have a native field that holds a pointer to a native Namespace object. See: runtime/bin/namespace.h Calls from e.g. file_impl.dart are now also passed a _Namespace object. The implementations in e.g. file.cc and file_linux.cc then extract the namespace, and use it to compute a file descriptor and path suitable for passing to e.g. openat(). related US-313 R=asiva@google.com, rmacnak@google.com Committed: https://github.com/dart-lang/sdk/commit/d0295c873c906567d0739a906950874380bafdbb

Patch Set 1 #

Total comments: 22

Patch Set 2 : Address comments #

Total comments: 1

Patch Set 3 : Fix d4w patch files #

Patch Set 4 : Remove namespace_unsupported.cc #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3572 lines, -1706 lines) Patch
M pkg/dev_compiler/tool/input_sdk/patch/io_patch.dart View 1 2 5 chunks +51 lines, -29 lines 0 comments Download
M runtime/bin/dartutils.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M runtime/bin/dartutils.cc View 3 chunks +17 lines, -2 lines 0 comments Download
M runtime/bin/directory.h View 10 chunks +29 lines, -14 lines 0 comments Download
M runtime/bin/directory.cc View 8 chunks +180 lines, -138 lines 0 comments Download
M runtime/bin/directory_android.cc View 1 13 chunks +158 lines, -106 lines 0 comments Download
M runtime/bin/directory_fuchsia.cc View 1 10 chunks +239 lines, -132 lines 0 comments Download
M runtime/bin/directory_linux.cc View 1 14 chunks +113 lines, -67 lines 0 comments Download
M runtime/bin/directory_macos.cc View 6 chunks +16 lines, -23 lines 0 comments Download
M runtime/bin/directory_patch.dart View 2 chunks +13 lines, -9 lines 0 comments Download
M runtime/bin/directory_test.cc View 4 chunks +28 lines, -25 lines 0 comments Download
M runtime/bin/directory_win.cc View 7 chunks +17 lines, -29 lines 0 comments Download
M runtime/bin/file.h View 2 chunks +37 lines, -20 lines 0 comments Download
M runtime/bin/file.cc View 23 chunks +541 lines, -500 lines 0 comments Download
M runtime/bin/file_android.cc View 1 17 chunks +200 lines, -86 lines 0 comments Download
M runtime/bin/file_fuchsia.cc View 1 16 chunks +182 lines, -100 lines 0 comments Download
M runtime/bin/file_linux.cc View 1 16 chunks +171 lines, -76 lines 0 comments Download
M runtime/bin/file_macos.cc View 14 chunks +50 lines, -33 lines 0 comments Download
M runtime/bin/file_patch.dart View 3 chunks +28 lines, -18 lines 0 comments Download
M runtime/bin/file_system_entity_patch.dart View 1 chunk +7 lines, -4 lines 0 comments Download
M runtime/bin/file_system_watcher.h View 2 chunks +2 lines, -0 lines 0 comments Download
M runtime/bin/file_system_watcher.cc View 4 chunks +10 lines, -7 lines 0 comments Download
M runtime/bin/file_system_watcher_android.cc View 3 chunks +7 lines, -1 line 0 comments Download
M runtime/bin/file_system_watcher_fuchsia.cc View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/bin/file_system_watcher_linux.cc View 3 chunks +4 lines, -0 lines 0 comments Download
M runtime/bin/file_system_watcher_macos.cc View 3 chunks +4 lines, -1 line 0 comments Download
M runtime/bin/file_system_watcher_win.cc View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/bin/file_test.cc View 4 chunks +4 lines, -4 lines 0 comments Download
M runtime/bin/file_win.cc View 18 chunks +40 lines, -23 lines 0 comments Download
M runtime/bin/gen_snapshot.cc View 4 chunks +4 lines, -4 lines 0 comments Download
M runtime/bin/io_impl_sources.gni View 1 chunk +7 lines, -0 lines 0 comments Download
M runtime/bin/io_natives.cc View 2 chunks +44 lines, -41 lines 0 comments Download
M runtime/bin/io_sources.gni View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/bin/main.cc View 1 11 chunks +29 lines, -7 lines 0 comments Download
A runtime/bin/namespace.h View 1 1 chunk +96 lines, -0 lines 0 comments Download
A runtime/bin/namespace.cc View 1 1 chunk +138 lines, -0 lines 0 comments Download
A runtime/bin/namespace_android.cc View 1 1 chunk +103 lines, -0 lines 0 comments Download
A runtime/bin/namespace_fuchsia.cc View 1 chunk +103 lines, -0 lines 0 comments Download
A runtime/bin/namespace_linux.cc View 1 1 chunk +103 lines, -0 lines 0 comments Download
A runtime/bin/namespace_macos.cc View 1 chunk +66 lines, -0 lines 0 comments Download
A runtime/bin/namespace_patch.dart View 1 chunk +45 lines, -0 lines 0 comments Download
A runtime/bin/namespace_win.cc View 1 chunk +67 lines, -0 lines 0 comments Download
M runtime/bin/platform_android.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/platform_fuchsia.cc View 2 chunks +6 lines, -6 lines 0 comments Download
M runtime/bin/platform_linux.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/platform_macos.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/platform_win.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/process.h View 2 chunks +3 lines, -1 line 0 comments Download
M runtime/bin/process.cc View 10 chunks +25 lines, -22 lines 0 comments Download
M runtime/bin/process_android.cc View 11 chunks +26 lines, -13 lines 0 comments Download
M runtime/bin/process_fuchsia.cc View 8 chunks +20 lines, -9 lines 0 comments Download
M runtime/bin/process_linux.cc View 10 chunks +56 lines, -14 lines 0 comments Download
M runtime/bin/process_macos.cc View 2 chunks +3 lines, -1 line 0 comments Download
M runtime/bin/process_patch.dart View 3 chunks +3 lines, -0 lines 0 comments Download
M runtime/bin/process_win.cc View 1 chunk +2 lines, -1 line 0 comments Download
M runtime/bin/security_context.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/bin/security_context_fuchsia.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/security_context_linux.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M runtime/bin/snapshot_utils.cc View 4 chunks +4 lines, -4 lines 0 comments Download
M runtime/vm/benchmark_test.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M sdk/lib/_internal/js_runtime/lib/io_patch.dart View 1 2 5 chunks +51 lines, -29 lines 0 comments Download
M sdk/lib/io/directory_impl.dart View 14 chunks +40 lines, -28 lines 0 comments Download
M sdk/lib/io/file_impl.dart View 18 chunks +61 lines, -41 lines 0 comments Download
M sdk/lib/io/file_system_entity.dart View 9 chunks +16 lines, -15 lines 0 comments Download
M sdk/lib/io/io.dart View 1 chunk +1 line, -0 lines 0 comments Download
M sdk/lib/io/io_sources.gni View 1 chunk +1 line, -0 lines 0 comments Download
M sdk/lib/io/link.dart View 6 chunks +12 lines, -9 lines 0 comments Download
A sdk/lib/io/namespace_impl.dart View 1 1 chunk +23 lines, -0 lines 0 comments Download
M tests/standalone/io/directory_test.dart View 2 chunks +17 lines, -0 lines 0 comments Download
A tests/standalone/io/namespace_test.dart View 1 chunk +232 lines, -0 lines 0 comments Download
M tests/standalone/standalone.status View 1 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 11 (4 generated)
zra
3 years, 3 months ago (2017-08-28 21:24:47 UTC) #3
siva
https://codereview.chromium.org/3007703002/diff/1/runtime/bin/namespace.cc File runtime/bin/namespace.cc (right): https://codereview.chromium.org/3007703002/diff/1/runtime/bin/namespace.cc#newcode22 runtime/bin/namespace.cc:22: Namespace* namespc = reinterpret_cast<Namespace*>(peer); ASSERT(namespc != NULL); or if ...
3 years, 3 months ago (2017-08-29 16:47:39 UTC) #4
rmacnak
I get a failure on standalone/io/file_test: FileSystemException: Failed to set file modification time, path = ...
3 years, 3 months ago (2017-08-29 18:00:13 UTC) #5
zra
Thanks! Fixed the test failure. https://codereview.chromium.org/3007703002/diff/1/runtime/bin/dartutils.h File runtime/bin/dartutils.h (right): https://codereview.chromium.org/3007703002/diff/1/runtime/bin/dartutils.h#newcode133 runtime/bin/dartutils.h:133: static Dart_Handle SetupIOLibrary(const char* ...
3 years, 3 months ago (2017-08-29 20:22:52 UTC) #6
rmacnak
lgtm
3 years, 3 months ago (2017-08-29 21:18:05 UTC) #8
siva
lgtm
3 years, 3 months ago (2017-08-29 22:13:03 UTC) #9
zra
3 years, 3 months ago (2017-08-30 16:34:43 UTC) #11
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
d0295c873c906567d0739a906950874380bafdbb (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698