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

Side by Side Diff: content/common/sandbox_linux/bpf_gpu_policy_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: rollback __NR_access 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/common/sandbox_linux/bpf_gpu_policy_linux.h" 5 #include "content/common/sandbox_linux/bpf_gpu_policy_linux.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 bool UpdateProcessTypeAndEnableSandbox(sandbox::bpf_dsl::SandboxBPFDSLPolicy* ( 162 bool UpdateProcessTypeAndEnableSandbox(sandbox::bpf_dsl::SandboxBPFDSLPolicy* (
163 *broker_sandboxer_allocator)(void)) { 163 *broker_sandboxer_allocator)(void)) {
164 DCHECK(broker_sandboxer_allocator); 164 DCHECK(broker_sandboxer_allocator);
165 UpdateProcessTypeToGpuBroker(); 165 UpdateProcessTypeToGpuBroker();
166 return SandboxSeccompBPF::StartSandboxWithExternalPolicy( 166 return SandboxSeccompBPF::StartSandboxWithExternalPolicy(
167 make_scoped_ptr(broker_sandboxer_allocator())); 167 make_scoped_ptr(broker_sandboxer_allocator()));
168 } 168 }
169 169
170 } // namespace 170 } // namespace
171 171
172 GpuProcessPolicy::GpuProcessPolicy() : broker_process_(NULL) {} 172 GpuProcessPolicy::GpuProcessPolicy() : GpuProcessPolicy(false) {
173 }
174
175 GpuProcessPolicy::GpuProcessPolicy(bool allow_mincore)
176 : broker_process_(NULL), allow_mincore_(allow_mincore) {
177 }
173 178
174 GpuProcessPolicy::~GpuProcessPolicy() {} 179 GpuProcessPolicy::~GpuProcessPolicy() {}
175 180
176 // Main policy for x86_64/i386. Extended by CrosArmGpuProcessPolicy. 181 // Main policy for x86_64/i386. Extended by CrosArmGpuProcessPolicy.
177 ResultExpr GpuProcessPolicy::EvaluateSyscall(int sysno) const { 182 ResultExpr GpuProcessPolicy::EvaluateSyscall(int sysno) const {
178 switch (sysno) { 183 switch (sysno) {
179 case __NR_ioctl: 184 case __NR_ioctl:
185 return Allow();
186 case __NR_mincore:
187 if (allow_mincore_) {
188 return Allow();
189 } else {
190 return SandboxBPFBasePolicy::EvaluateSyscall(sysno);
191 }
180 #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) 192 #if defined(__i386__) || defined(__x86_64__) || defined(__mips__)
181 // The Nvidia driver uses flags not in the baseline policy 193 // The Nvidia driver uses flags not in the baseline policy
182 // (MAP_LOCKED | MAP_EXECUTABLE | MAP_32BIT) 194 // (MAP_LOCKED | MAP_EXECUTABLE | MAP_32BIT)
183 case __NR_mmap: 195 case __NR_mmap:
184 #endif 196 #endif
185 // We also hit this on the linux_chromeos bot but don't yet know what 197 // We also hit this on the linux_chromeos bot but don't yet know what
186 // weird flags were involved. 198 // weird flags were involved.
187 case __NR_mprotect: 199 case __NR_mprotect:
188 // TODO(jln): restrict prctl. 200 // TODO(jln): restrict prctl.
189 case __NR_prctl: 201 case __NR_prctl:
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), 282 broker_process_ = new BrokerProcess(GetFSDeniedErrno(),
271 read_whitelist, 283 read_whitelist,
272 write_whitelist); 284 write_whitelist);
273 // The initialization callback will perform generic initialization and then 285 // The initialization callback will perform generic initialization and then
274 // call broker_sandboxer_callback. 286 // call broker_sandboxer_callback.
275 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, 287 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox,
276 broker_sandboxer_allocator))); 288 broker_sandboxer_allocator)));
277 } 289 }
278 290
279 } // namespace content 291 } // namespace content
OLDNEW
« no previous file with comments | « content/common/sandbox_linux/bpf_gpu_policy_linux.h ('k') | content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698