Index: content/common/sandbox_linux/sandbox_linux.cc |
diff --git a/content/common/sandbox_linux/sandbox_linux.cc b/content/common/sandbox_linux/sandbox_linux.cc |
index a30e41c416581d872f18bf2fabaac1cea33b9e31..b912aa364d1b9fc56e577ef8a90beb957b4f507c 100644 |
--- a/content/common/sandbox_linux/sandbox_linux.cc |
+++ b/content/common/sandbox_linux/sandbox_linux.cc |
@@ -79,6 +79,14 @@ bool IsRunningTSAN() { |
#endif |
} |
+bool IsChromeOS() { |
+#if defined(OS_CHROMEOS) |
+ return true; |
+#else |
+ return false; |
+#endif |
+} |
+ |
// Try to open /proc/self/task/ with the help of |proc_fd|. |proc_fd| can be |
// -1. Will return -1 on error and set errno like open(2). |
int OpenProcTaskFd(int proc_fd) { |
@@ -236,9 +244,9 @@ bool LinuxSandbox::StartSeccompBPF(const std::string& process_type) { |
} |
bool LinuxSandbox::InitializeSandboxImpl() { |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
const std::string process_type = |
- CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
- switches::kProcessType); |
+ command_line->GetSwitchValueASCII(switches::kProcessType); |
// We need to make absolutely sure that our sandbox is "sealed" before |
// returning. |
@@ -261,10 +269,20 @@ bool LinuxSandbox::InitializeSandboxImpl() { |
// even report an error about it. |
if (IsRunningTSAN()) |
return false; |
- // The GPU process is allowed to call InitializeSandbox() with threads for |
- // now, because it loads third-party libraries. |
- if (process_type != switches::kGpuProcess) |
+ |
+ bool sandbox_failure_nonfatal = false; |
jln (very slow on Chromium)
2014/03/06 23:02:30
So, on non regular Linux, this will crash, no?
ni
Jorge Lucangeli Obes
2014/03/07 00:29:44
Done. Was halfway done changing the name of the fl
|
+ |
+ // On Chrome OS, the GPU process is allowed to call InitializeSandbox() |
+ // with threads, but only if '--gpu-sandbox-failures-nonfatal' is passed. |
+ if (IsChromeOS()) { |
+ sandbox_failure_nonfatal = |
+ process_type == switches::kGpuProcess && |
+ command_line->HasSwitch(switches::kGpuSandboxFailuresNonfatal); |
+ } |
+ |
+ if (!sandbox_failure_nonfatal) |
CHECK(false) << error_message; |
jln (very slow on Chromium)
2014/03/06 23:02:30
LOG(FATAL) instead?
Jorge Lucangeli Obes
2014/03/07 00:29:44
Done.
|
+ |
LOG(ERROR) << error_message; |
return false; |
} |