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

Side by Side Diff: content/common/sandbox_linux/bpf_renderer_policy_linux.cc

Issue 1262043002: Implement DRM Native Pixmap using prime buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new-master
Patch Set: dshwang nits Created 4 years, 9 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
« no previous file with comments | « content/common/child_process_messages.h ('k') | content/content_common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_renderer_policy_linux.h" 5 #include "content/common/sandbox_linux/bpf_renderer_policy_linux.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <libdrm/drm.h>
8 #include <sys/ioctl.h> 9 #include <sys/ioctl.h>
9 10
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 #include "content/common/sandbox_linux/sandbox_linux.h" 12 #include "content/common/sandbox_linux/sandbox_linux.h"
12 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" 13 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
13 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" 14 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
14 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" 15 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
15 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" 16 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h"
16 #include "sandbox/linux/system_headers/linux_syscalls.h" 17 #include "sandbox/linux/system_headers/linux_syscalls.h"
17 18
18 #if defined(USE_VGEM_MAP)
19 #include <libdrm/vgem_drm.h>
20 #endif
21
22 using sandbox::SyscallSets; 19 using sandbox::SyscallSets;
23 using sandbox::bpf_dsl::Allow; 20 using sandbox::bpf_dsl::Allow;
24 using sandbox::bpf_dsl::Arg; 21 using sandbox::bpf_dsl::Arg;
25 using sandbox::bpf_dsl::Error; 22 using sandbox::bpf_dsl::Error;
26 using sandbox::bpf_dsl::ResultExpr; 23 using sandbox::bpf_dsl::ResultExpr;
27 24
28 namespace content { 25 namespace content {
29 26
30 namespace { 27 namespace {
31 28
32 ResultExpr RestrictIoctl() { 29 ResultExpr RestrictIoctl() {
33 const Arg<unsigned long> request(1); 30 const Arg<unsigned long> request(1);
34 return Switch(request) 31 return Switch(request)
35 .SANDBOX_BPF_DSL_CASES((static_cast<unsigned long>(TCGETS), FIONREAD), 32 .SANDBOX_BPF_DSL_CASES((static_cast<unsigned long>(TCGETS), FIONREAD),
36 Allow()) 33 Allow())
37 #if defined(USE_VGEM_MAP)
38 // Type of DRM_IOCTL_XXX is unsigned long on IA and unsigned int on ARM. 34 // Type of DRM_IOCTL_XXX is unsigned long on IA and unsigned int on ARM.
39 .SANDBOX_BPF_DSL_CASES( 35 .SANDBOX_BPF_DSL_CASES(
40 (static_cast<unsigned long>(DRM_IOCTL_GEM_CLOSE), 36 (static_cast<unsigned long>(DRM_IOCTL_GEM_CLOSE),
41 DRM_IOCTL_VGEM_MODE_MAP_DUMB, DRM_IOCTL_PRIME_FD_TO_HANDLE), 37 DRM_IOCTL_PRIME_FD_TO_HANDLE),
piman 2016/03/23 21:26:00 Actually, do we still need these in the renderer?
42 Allow()) 38 Allow())
43 #endif
44 .Default(sandbox::CrashSIGSYSIoctl()); 39 .Default(sandbox::CrashSIGSYSIoctl());
45 } 40 }
46 41
47 } // namespace 42 } // namespace
48 43
49 RendererProcessPolicy::RendererProcessPolicy() {} 44 RendererProcessPolicy::RendererProcessPolicy() {}
50 RendererProcessPolicy::~RendererProcessPolicy() {} 45 RendererProcessPolicy::~RendererProcessPolicy() {}
51 46
52 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const { 47 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const {
53 switch (sysno) { 48 switch (sysno) {
(...skipping 29 matching lines...) Expand all
83 return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno); 78 return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno);
84 case __NR_prlimit64: 79 case __NR_prlimit64:
85 return Error(EPERM); // See crbug.com/160157. 80 return Error(EPERM); // See crbug.com/160157.
86 default: 81 default:
87 // Default on the content baseline policy. 82 // Default on the content baseline policy.
88 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); 83 return SandboxBPFBasePolicy::EvaluateSyscall(sysno);
89 } 84 }
90 } 85 }
91 86
92 } // namespace content 87 } // namespace content
OLDNEW
« no previous file with comments | « content/common/child_process_messages.h ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698