| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/zygote_host_linux.h" | 5 #include "chrome/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> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 switches::kLoggingLevel, | 89 switches::kLoggingLevel, |
| 90 switches::kEnableLogging, // Support, e.g., --enable-logging=stderr. | 90 switches::kEnableLogging, // Support, e.g., --enable-logging=stderr. |
| 91 switches::kUserDataDir, // Make logs go to the right file. | 91 switches::kUserDataDir, // Make logs go to the right file. |
| 92 // Load (in-process) Pepper plugins in-process in the zygote pre-sandbox. | 92 // Load (in-process) Pepper plugins in-process in the zygote pre-sandbox. |
| 93 switches::kRegisterPepperPlugins, | 93 switches::kRegisterPepperPlugins, |
| 94 #if defined(USE_SECCOMP_SANDBOX) | 94 #if defined(USE_SECCOMP_SANDBOX) |
| 95 switches::kDisableSeccompSandbox, | 95 switches::kDisableSeccompSandbox, |
| 96 #else | 96 #else |
| 97 switches::kEnableSeccompSandbox, | 97 switches::kEnableSeccompSandbox, |
| 98 #endif | 98 #endif |
| 99 NULL | |
| 100 }; | 99 }; |
| 101 for (const char** sw = kForwardSwitches; *sw; sw++) { | 100 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, |
| 102 if (browser_command_line.HasSwitch(*sw)) { | 101 arraysize(kForwardSwitches)); |
| 103 // Always append with value for those switches which need it; it does no | |
| 104 // harm for those which don't. | |
| 105 cmd_line.AppendSwitchWithValue(*sw, | |
| 106 browser_command_line.GetSwitchValueASCII(*sw)); | |
| 107 } | |
| 108 } | |
| 109 | 102 |
| 110 sandbox_binary_ = sandbox_cmd.c_str(); | 103 sandbox_binary_ = sandbox_cmd.c_str(); |
| 111 struct stat st; | 104 struct stat st; |
| 112 | 105 |
| 113 if (!sandbox_cmd.empty() && stat(sandbox_binary_.c_str(), &st) == 0) { | 106 if (!sandbox_cmd.empty() && stat(sandbox_binary_.c_str(), &st) == 0) { |
| 114 if (access(sandbox_binary_.c_str(), X_OK) == 0 && | 107 if (access(sandbox_binary_.c_str(), X_OK) == 0 && |
| 115 (st.st_uid == 0) && | 108 (st.st_uid == 0) && |
| 116 (st.st_mode & S_ISUID) && | 109 (st.st_mode & S_ISUID) && |
| 117 (st.st_mode & S_IXOTH)) { | 110 (st.st_mode & S_IXOTH)) { |
| 118 using_suid_sandbox_ = true; | 111 using_suid_sandbox_ = true; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { | 332 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { |
| 340 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; | 333 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; |
| 341 return false; | 334 return false; |
| 342 } | 335 } |
| 343 | 336 |
| 344 if (child_exited) | 337 if (child_exited) |
| 345 *child_exited = tmp_child_exited; | 338 *child_exited = tmp_child_exited; |
| 346 | 339 |
| 347 return did_crash; | 340 return did_crash; |
| 348 } | 341 } |
| OLD | NEW |