Commit f1b12ddf authored by Sergey Ulanov's avatar Sergey Ulanov

Revert "[Fuchsia] Allow namespace overrides in base::LaunchProcess"

This reverts commit 48d32d67.

Reason for revert: FDIO doesn't handle overrides as expected.

Original change's description:
> [Fuchsia] Allow namespace overrides in base::LaunchProcess
> 
> Previously base::LaunchProcess didn't allow paths_to_transfer to be used
> with the FDIO_SPAWN_CLONE_NAMESPACE flag. This meant that to override
> directories the test launcher had to avoid FDIO_SPAWN_CLONE_NAMESPACE
> flag. This is not ideal because of the added complexity in the test
> launcher and also because the launcher was changing test environment
> by not cloning all entries in the namespace (i.e. some tests would behave
> differently when started with --single-process-tests flag). This change
> updates LaunchProcess() to allow individual dirs transfer while cloning
> the rest of the namespace. Also updated test launcher to use this new
> feature.
> 
> This CL should unbreak the tests currently broken in
> https://crrev.com/c/1341243
> 
> Change-Id: I3c30497222ffd33d6240f478523d3e767fad90f5
> Reviewed-on: https://chromium-review.googlesource.com/c/1345236
> Reviewed-by: Scott Graham <scottmg@chromium.org>
> Reviewed-by: Nico Weber <thakis@chromium.org>
> Commit-Queue: Nico Weber <thakis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#610042}

TBR=thakis@chromium.org,kmarshall@chromium.org,sergeyu@chromium.org,scottmg@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Iecb39de51037b41cc4b75914c688e1b412dcce71
Reviewed-on: https://chromium-review.googlesource.com/c/1351788Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611007}
parent 77d47636
......@@ -216,8 +216,8 @@ struct BASE_EXPORT LaunchOptions {
std::vector<FilePath> paths_to_clone;
// Specifies handles which will be installed as files or directories in the
// child process' namespace. Paths installed by |paths_to_clone| or
// FDIO_SPAWN_CLONE_NAMESPACE flag will be overridden by these entries.
// child process' namespace. Paths installed by |paths_to_clone| will be
// overridden by these entries.
std::vector<PathToTransfer> paths_to_transfer;
#endif // defined(OS_FUCHSIA)
......
......@@ -159,10 +159,7 @@ Process LaunchProcess(const std::vector<std::string>& argv,
// Add actions to clone handles for any specified paths into the new process'
// namespace.
if (!options.paths_to_clone.empty() || !options.paths_to_transfer.empty()) {
// |paths_to_clone| doesn't make sense with FDIO_SPAWN_CLONE_NAMESPACE.
DCHECK((options.spawn_flags & FDIO_SPAWN_CLONE_NAMESPACE) == 0 ||
options.paths_to_clone.empty());
DCHECK((options.spawn_flags & FDIO_SPAWN_CLONE_NAMESPACE) == 0);
transferred_handles.reserve(transferred_handles.size() +
options.paths_to_clone.size() +
options.paths_to_transfer.size());
......
......@@ -325,9 +325,15 @@ int LaunchChildTestProcessWithOptions(const CommandLine& command_line,
#elif defined(OS_FUCHSIA)
DCHECK(!new_options.job_handle);
// Set the clone policy.
new_options.spawn_flags = FDIO_SPAWN_CLONE_STDIO | FDIO_SPAWN_CLONE_JOB |
FDIO_SPAWN_CLONE_NAMESPACE;
// Set the clone policy, deliberately omitting FDIO_SPAWN_CLONE_NAMESPACE so
// that we can install a different /data.
new_options.spawn_flags = FDIO_SPAWN_CLONE_STDIO | FDIO_SPAWN_CLONE_JOB;
new_options.paths_to_clone.push_back(base::FilePath("/config/ssl"));
new_options.paths_to_clone.push_back(base::FilePath("/dev/null"));
new_options.paths_to_clone.push_back(base::FilePath("/dev/zero"));
new_options.paths_to_clone.push_back(base::FilePath("/pkg"));
new_options.paths_to_clone.push_back(base::FilePath("/svc"));
new_options.paths_to_clone.push_back(base::FilePath("/tmp"));
zx::job job_handle;
zx_status_t result = zx::job::create(*GetDefaultJob(), 0, &job_handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment