OLD | NEW |
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> |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, | 114 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, |
115 arraysize(kForwardSwitches)); | 115 arraysize(kForwardSwitches)); |
116 | 116 |
117 content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( | 117 content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( |
118 &cmd_line, -1); | 118 &cmd_line, -1); |
119 | 119 |
120 sandbox_binary_ = sandbox_cmd.c_str(); | 120 sandbox_binary_ = sandbox_cmd.c_str(); |
121 | 121 |
122 if (!sandbox_cmd.empty()) { | 122 if (!sandbox_cmd.empty()) { |
123 struct stat st; | 123 struct stat st; |
124 if (stat(sandbox_binary_.c_str(), &st) == 0 && | 124 if (stat(sandbox_binary_.c_str(), &st) != 0) { |
125 access(sandbox_binary_.c_str(), X_OK) == 0 && | 125 LOG(FATAL) << "The SUID sandbox helper binary is missing: " |
| 126 << sandbox_binary_ << " Aborting now."; |
| 127 } |
| 128 |
| 129 if (access(sandbox_binary_.c_str(), X_OK) == 0 && |
126 (st.st_uid == 0) && | 130 (st.st_uid == 0) && |
127 (st.st_mode & S_ISUID) && | 131 (st.st_mode & S_ISUID) && |
128 (st.st_mode & S_IXOTH)) { | 132 (st.st_mode & S_IXOTH)) { |
129 using_suid_sandbox_ = true; | 133 using_suid_sandbox_ = true; |
130 cmd_line.PrependWrapper(sandbox_binary_); | 134 cmd_line.PrependWrapper(sandbox_binary_); |
131 | 135 |
132 SaveSUIDUnsafeEnvironmentVariables(); | 136 SaveSUIDUnsafeEnvironmentVariables(); |
133 } else { | 137 } else { |
134 LOG(FATAL) << "The SUID sandbox helper binary was found, but is not " | 138 LOG(FATAL) << "The SUID sandbox helper binary was found, but is not " |
135 "configured correctly. Rather than run without sandboxing " | 139 "configured correctly. Rather than run without sandboxing " |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 !read_pickle.ReadInt(&iter, &tmp_exit_code)) { | 374 !read_pickle.ReadInt(&iter, &tmp_exit_code)) { |
371 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; | 375 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; |
372 return base::TERMINATION_STATUS_NORMAL_TERMINATION; | 376 return base::TERMINATION_STATUS_NORMAL_TERMINATION; |
373 } | 377 } |
374 | 378 |
375 if (exit_code) | 379 if (exit_code) |
376 *exit_code = tmp_exit_code; | 380 *exit_code = tmp_exit_code; |
377 | 381 |
378 return static_cast<base::TerminationStatus>(status); | 382 return static_cast<base::TerminationStatus>(status); |
379 } | 383 } |
OLD | NEW |