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

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

Issue 1840923002: Removed setuid Sandbox Check as Per Bug#598454 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added conditional to keep the sandbox in ChromeOS Created 4 years, 8 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
« no previous file with comments | « AUTHORS ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser_main_loop.h" 5 #include "content/browser/browser_main_loop.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 #endif 185 #endif
186 186
187 // One of the linux specific headers defines this as a macro. 187 // One of the linux specific headers defines this as a macro.
188 #ifdef DestroyAll 188 #ifdef DestroyAll
189 #undef DestroyAll 189 #undef DestroyAll
190 #endif 190 #endif
191 191
192 namespace content { 192 namespace content {
193 namespace { 193 namespace {
194 194
195 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 195 #if defined(OS_CHROMEOS)
196 void SetupSandbox(const base::CommandLine& parsed_command_line) { 196 void SetupSandbox(const base::CommandLine& parsed_command_line) {
197 TRACE_EVENT0("startup", "SetupSandbox"); 197 TRACE_EVENT0("startup", "SetupSandbox");
198 base::FilePath sandbox_binary; 198 base::FilePath sandbox_binary;
199 199
200 scoped_ptr<sandbox::SetuidSandboxHost> setuid_sandbox_host( 200 scoped_ptr<sandbox::SetuidSandboxHost> setuid_sandbox_host(
201 sandbox::SetuidSandboxHost::Create()); 201 sandbox::SetuidSandboxHost::Create());
202 202
203 const bool want_setuid_sandbox = 203 const bool want_setuid_sandbox =
204 !parsed_command_line.HasSwitch(switches::kNoSandbox) && 204 !parsed_command_line.HasSwitch(switches::kNoSandbox) &&
205 !parsed_command_line.HasSwitch(switches::kDisableSetuidSandbox) && 205 !parsed_command_line.HasSwitch(switches::kDisableSetuidSandbox) &&
(...skipping 15 matching lines...) Expand all
221 } 221 }
222 222
223 // Tickle the sandbox host and zygote host so they fork now. 223 // Tickle the sandbox host and zygote host so they fork now.
224 RenderSandboxHostLinux::GetInstance()->Init(); 224 RenderSandboxHostLinux::GetInstance()->Init();
225 ZygoteHostImpl::GetInstance()->Init(sandbox_binary.value()); 225 ZygoteHostImpl::GetInstance()->Init(sandbox_binary.value());
226 *GetGenericZygote() = CreateZygote(); 226 *GetGenericZygote() = CreateZygote();
227 RenderProcessHostImpl::EarlyZygoteLaunch(); 227 RenderProcessHostImpl::EarlyZygoteLaunch();
228 } 228 }
229 #endif 229 #endif
230 230
231
232 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && !defined (OS_CHROMEOS)
233 void SetupSandbox() {
mdempsky 2016/04/01 23:25:42 I don't understand why you're duplicating all of t
234 base::FilePath sandbox_binary;
235 RenderSandboxHostLinux::GetInstance()->Init();
236 ZygoteHostImpl::GetInstance()->Init(sandbox_binary.value());
237 *GetGenericZygote() = CreateZygote();
238 RenderProcessHostImpl::EarlyZygoteLaunch();
239 }
240 #endif
231 #if defined(USE_GLIB) 241 #if defined(USE_GLIB)
232 static void GLibLogHandler(const gchar* log_domain, 242 static void GLibLogHandler(const gchar* log_domain,
233 GLogLevelFlags log_level, 243 GLogLevelFlags log_level,
234 const gchar* message, 244 const gchar* message,
235 gpointer userdata) { 245 gpointer userdata) {
236 if (!log_domain) 246 if (!log_domain)
237 log_domain = "<unknown>"; 247 log_domain = "<unknown>";
238 if (!message) 248 if (!message)
239 message = "<no message>"; 249 message = "<no message>";
240 250
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 GetContentClient()->browser()->CreateBrowserMainParts(parameters_)); 443 GetContentClient()->browser()->CreateBrowserMainParts(parameters_));
434 } 444 }
435 445
436 // BrowserMainLoop stages ================================================== 446 // BrowserMainLoop stages ==================================================
437 447
438 void BrowserMainLoop::EarlyInitialization() { 448 void BrowserMainLoop::EarlyInitialization() {
439 TRACE_EVENT0("startup", "BrowserMainLoop::EarlyInitialization"); 449 TRACE_EVENT0("startup", "BrowserMainLoop::EarlyInitialization");
440 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::EarlyInitialization"); 450 TRACK_SCOPED_REGION("Startup", "BrowserMainLoop::EarlyInitialization");
441 451
442 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 452 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
443 // No thread should be created before this call, as SetupSandbox() 453 SetupSandbox();
mdempsky 2016/04/01 23:25:43 This won't compile on Chrome OS: your SetupSandbox
444 // will end-up using fork().
445 SetupSandbox(parsed_command_line_);
446 #endif 454 #endif
447
448 #if defined(USE_X11) 455 #if defined(USE_X11)
449 if (UsingInProcessGpu()) { 456 if (UsingInProcessGpu()) {
450 if (!gfx::InitializeThreadedX11()) { 457 if (!gfx::InitializeThreadedX11()) {
451 LOG(ERROR) << "Failed to put Xlib into threaded mode."; 458 LOG(ERROR) << "Failed to put Xlib into threaded mode.";
452 } 459 }
453 } 460 }
454 #endif 461 #endif
455 462
456 // GLib's spawning of new processes is buggy, so it's important that at this 463 // GLib's spawning of new processes is buggy, so it's important that at this
457 // point GLib does not need to start DBUS. Chrome should always start with 464 // point GLib does not need to start DBUS. Chrome should always start with
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 DCHECK(is_tracing_startup_for_duration_); 1453 DCHECK(is_tracing_startup_for_duration_);
1447 1454
1448 is_tracing_startup_for_duration_ = false; 1455 is_tracing_startup_for_duration_ = false;
1449 TracingController::GetInstance()->StopTracing( 1456 TracingController::GetInstance()->StopTracing(
1450 TracingController::CreateFileSink( 1457 TracingController::CreateFileSink(
1451 startup_trace_file_, 1458 startup_trace_file_,
1452 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); 1459 base::Bind(OnStoppedStartupTracing, startup_trace_file_)));
1453 } 1460 }
1454 1461
1455 } // namespace content 1462 } // namespace content
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698