Index: content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc |
diff --git a/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc b/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc |
index e9d5f6bb4cc5f04df2bd48eeb9cd4df44e4a5409..f5fb71e09654a8b4d2311c38c5df6bd7ba168927 100644 |
--- a/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc |
+++ b/content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc |
@@ -34,6 +34,10 @@ |
#include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
#include "sandbox/linux/services/linux_syscalls.h" |
+#if !defined(IN_NACL_HELPER) |
+#include "ui/gl/gl_switches.h" |
+#endif |
+ |
using sandbox::BaselinePolicy; |
using sandbox::SandboxBPF; |
using sandbox::SyscallSets; |
@@ -154,6 +158,28 @@ void StartSandboxWithPolicy(sandbox::bpf_dsl::SandboxBPFDSLPolicy* policy) { |
// nacl_helper needs to be tiny and includes only part of content/ |
// in its dependencies. Make sure to not link things that are not needed. |
#if !defined(IN_NACL_HELPER) |
+class GpuEGLProcessPolicy : public GpuProcessPolicy { |
jln (very slow on Chromium)
2014/10/17 18:13:38
Why make it a new class? If you really need this,
|
+ public: |
+ GpuEGLProcessPolicy() { } |
+ virtual ~GpuEGLProcessPolicy() {} |
+ |
+ virtual ResultExpr EvaluateSyscall( |
+ int sysno) const override; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(GpuEGLProcessPolicy); |
+}; |
+ |
+ResultExpr GpuEGLProcessPolicy::EvaluateSyscall(int sysno) const { |
+ switch (sysno) { |
+ // eglCreateWindowSurface() needs mincore(). |
+ case __NR_mincore: |
+ return Allow(); |
+ default: |
+ return GpuProcessPolicy::EvaluateSyscall(sysno); |
+ } |
+} |
+ |
scoped_ptr<SandboxBPFBasePolicy> GetGpuProcessSandbox() { |
const base::CommandLine& command_line = |
*base::CommandLine::ForCurrentProcess(); |
@@ -167,7 +193,13 @@ scoped_ptr<SandboxBPFBasePolicy> GetGpuProcessSandbox() { |
return scoped_ptr<SandboxBPFBasePolicy>( |
new CrosArmGpuProcessPolicy(allow_sysv_shm)); |
} else { |
- return scoped_ptr<SandboxBPFBasePolicy>(new GpuProcessPolicy); |
+ if (command_line.HasSwitch(switches::kUseGL) && |
+ command_line.GetSwitchValueASCII(switches::kUseGL) == |
+ gfx::kGLImplementationEGLName) { |
+ return scoped_ptr<SandboxBPFBasePolicy>(new GpuEGLProcessPolicy); |
+ } else { |
+ return scoped_ptr<SandboxBPFBasePolicy>(new GpuProcessPolicy); |
+ } |
} |
} |