Index: content/common/sandbox_init_linux.cc |
diff --git a/content/common/sandbox_init_linux.cc b/content/common/sandbox_init_linux.cc |
index 1dd1554ff064ceaba55fdb10b49f07530b82a0e1..c10b3fb092e6ba817b132e9ca8f026af2263cfc0 100644 |
--- a/content/common/sandbox_init_linux.cc |
+++ b/content/common/sandbox_init_linux.cc |
@@ -22,6 +22,7 @@ |
#include "base/file_util.h" |
#include "base/logging.h" |
#include "base/time.h" |
+#include "content/gpu/gpu_info_collector.h" |
Chris Evans
2012/06/07 23:11:34
I'm not 100% sure, but isn't it considered a layer
Jorge Lucangeli Obes
2012/06/08 00:15:24
GPU info logic moved to gpu_main.cc, but cmdline f
|
#include "content/public/common/content_switches.h" |
#ifndef PR_SET_NO_NEW_PRIVS |
@@ -388,6 +389,22 @@ static void InstallFilter(const std::vector<struct sock_filter>& program) { |
PLOG_IF(FATAL, ret != 0) << "Failed to install filter."; |
} |
+static bool ShouldEnableGPUSandbox() { |
+#if defined(OS_CHROMEOS) |
+ content::GPUInfo gpu_info; |
+ |
+ if (!gpu_info_collector::CollectGraphicsInfo(&gpu_info)) |
+ return false; |
+ |
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
+ |
+ return command_line.HasSwitch(switches::kEnableChromeOSGPUSandbox) && |
+ gpu_info.gpu.vendor_id == 0x8086; // Intel GPU |
+#else |
+ return true; |
+#endif |
+} |
+ |
} // anonymous namespace |
namespace content { |
@@ -412,7 +429,8 @@ void InitializeSandbox() { |
std::vector<struct sock_filter> program; |
EmitPreamble(&program); |
- if (process_type == switches::kGpuProcess) { |
+ if (process_type == switches::kGpuProcess && |
+ ShouldEnableGPUSandbox()) { |
ApplyGPUPolicy(&program); |
EmitTrap(&program); // Default deny. |
} else if (process_type == switches::kPpapiPluginProcess) { |
@@ -442,4 +460,3 @@ void InitializeSandbox() { |
} // namespace content |
#endif |
- |