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

Side by Side Diff: content/browser/zygote_host_linux.cc

Issue 7046114: Remove content dependency on chrome/browser/accessibility/browser_accessibility_state.h and chrom... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/worker_host/worker_service.cc ('k') | content/browser/zygote_main_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/zygote_host_linux.h" 5 #include "content/browser/zygote_host_linux.h"
6 6
7 #include <sys/socket.h> 7 #include <sys/socket.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <unistd.h> 10 #include <unistd.h>
11 11
12 #include "base/base_switches.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/eintr_wrapper.h" 14 #include "base/eintr_wrapper.h"
14 #include "base/environment.h" 15 #include "base/environment.h"
15 #include "base/linux_util.h" 16 #include "base/linux_util.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
18 #include "base/path_service.h" 19 #include "base/path_service.h"
19 #include "base/pickle.h" 20 #include "base/pickle.h"
20 #include "base/process_util.h" 21 #include "base/process_util.h"
21 #include "base/string_number_conversions.h" 22 #include "base/string_number_conversions.h"
22 #include "base/string_util.h" 23 #include "base/string_util.h"
23 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
24 #include "chrome/common/chrome_constants.h" 25 #include "chrome/common/chrome_constants.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "content/browser/content_browser_client.h"
26 #include "content/browser/renderer_host/render_sandbox_host_linux.h" 27 #include "content/browser/renderer_host/render_sandbox_host_linux.h"
28 #include "content/common/content_switches.h"
27 #include "content/common/process_watcher.h" 29 #include "content/common/process_watcher.h"
28 #include "content/common/result_codes.h" 30 #include "content/common/result_codes.h"
29 #include "content/common/unix_domain_socket_posix.h" 31 #include "content/common/unix_domain_socket_posix.h"
30 #include "sandbox/linux/suid/suid_unsafe_environment_variables.h" 32 #include "sandbox/linux/suid/suid_unsafe_environment_variables.h"
31 33
32 static void SaveSUIDUnsafeEnvironmentVariables() { 34 static void SaveSUIDUnsafeEnvironmentVariables() {
33 // The ELF loader will clear many environment variables so we save them to 35 // The ELF loader will clear many environment variables so we save them to
34 // different names here so that the SUID sandbox can resolve them for the 36 // different names here so that the SUID sandbox can resolve them for the
35 // renderer. 37 // renderer.
36 38
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 cmd_line.PrependWrapper( 99 cmd_line.PrependWrapper(
98 browser_command_line.GetSwitchValueNative(switches::kZygoteCmdPrefix)); 100 browser_command_line.GetSwitchValueNative(switches::kZygoteCmdPrefix));
99 } 101 }
100 // Append any switches from the browser process that need to be forwarded on 102 // Append any switches from the browser process that need to be forwarded on
101 // to the zygote/renderers. 103 // to the zygote/renderers.
102 // Should this list be obtained from browser_render_process_host.cc? 104 // Should this list be obtained from browser_render_process_host.cc?
103 static const char* kForwardSwitches[] = { 105 static const char* kForwardSwitches[] = {
104 switches::kAllowSandboxDebugging, 106 switches::kAllowSandboxDebugging,
105 switches::kLoggingLevel, 107 switches::kLoggingLevel,
106 switches::kEnableLogging, // Support, e.g., --enable-logging=stderr. 108 switches::kEnableLogging, // Support, e.g., --enable-logging=stderr.
107 switches::kEnableRemoting,
108 switches::kV, 109 switches::kV,
109 switches::kVModule, 110 switches::kVModule,
110 switches::kUserDataDir, // Make logs go to the right file.
111 // Load (in-process) Pepper plugins in-process in the zygote pre-sandbox.
112 switches::kPpapiFlashInProcess,
113 switches::kPpapiFlashPath,
114 switches::kPpapiFlashVersion,
115 switches::kRegisterPepperPlugins, 111 switches::kRegisterPepperPlugins,
116 switches::kDisableSeccompSandbox, 112 switches::kDisableSeccompSandbox,
117 switches::kEnableSeccompSandbox, 113 switches::kEnableSeccompSandbox,
118 }; 114 };
119 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, 115 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches,
120 arraysize(kForwardSwitches)); 116 arraysize(kForwardSwitches));
121 117
118 content::GetContentClient()->browser()->AppendExtraCommandLineSwitches(
119 &cmd_line, -1);
120
122 sandbox_binary_ = sandbox_cmd.c_str(); 121 sandbox_binary_ = sandbox_cmd.c_str();
123 struct stat st; 122 struct stat st;
124 123
125 if (!sandbox_cmd.empty() && stat(sandbox_binary_.c_str(), &st) == 0) { 124 if (!sandbox_cmd.empty() && stat(sandbox_binary_.c_str(), &st) == 0) {
126 if (access(sandbox_binary_.c_str(), X_OK) == 0 && 125 if (access(sandbox_binary_.c_str(), X_OK) == 0 &&
127 (st.st_uid == 0) && 126 (st.st_uid == 0) &&
128 (st.st_mode & S_ISUID) && 127 (st.st_mode & S_ISUID) &&
129 (st.st_mode & S_IXOTH)) { 128 (st.st_mode & S_IXOTH)) {
130 using_suid_sandbox_ = true; 129 using_suid_sandbox_ = true;
131 cmd_line.PrependWrapper(sandbox_binary_); 130 cmd_line.PrependWrapper(sandbox_binary_);
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 !read_pickle.ReadInt(&iter, &tmp_exit_code)) { 363 !read_pickle.ReadInt(&iter, &tmp_exit_code)) {
365 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; 364 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote.";
366 return base::TERMINATION_STATUS_NORMAL_TERMINATION; 365 return base::TERMINATION_STATUS_NORMAL_TERMINATION;
367 } 366 }
368 367
369 if (exit_code) 368 if (exit_code)
370 *exit_code = tmp_exit_code; 369 *exit_code = tmp_exit_code;
371 370
372 return static_cast<base::TerminationStatus>(status); 371 return static_cast<base::TerminationStatus>(status);
373 } 372 }
OLDNEW
« no previous file with comments | « content/browser/worker_host/worker_service.cc ('k') | content/browser/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698