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

Unified Diff: content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc

Issue 656023003: Fix crash with --use-gl=egl on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shorten code Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698