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

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

Issue 1841683003: ui/ozone: Flush CPU caches when mapping/unmapping prime pixmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ran git cl format Created 4 years, 8 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 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 <sys/ioctl.h> 8 #include <sys/ioctl.h>
9 9
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "content/common/sandbox_linux/sandbox_linux.h" 11 #include "content/common/sandbox_linux/sandbox_linux.h"
12 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" 12 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
13 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" 13 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
14 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" 14 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
15 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" 15 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h"
16 #include "sandbox/linux/system_headers/linux_syscalls.h" 16 #include "sandbox/linux/system_headers/linux_syscalls.h"
17 17
18 #if defined(OS_CHROMEOS)
19 // TODO(vignatti): replace the local definitions below with #include
20 // <linux/dma-buf.h> once kernel version 4.6 becomes widely used.
21 #include <linux/types.h>
22
23 struct local_dma_buf_sync {
24 __u64 flags;
25 };
26 #define LOCAL_DMA_BUF_BASE 'b'
rickyz (no longer on Chrome) 2016/04/06 02:04:48 Not sure how problematic this is likely to be with
vignatti (out of this project) 2016/04/06 13:52:46 https://github.com/torvalds/linux/blob/master/Docu
27 #define LOCAL_DMA_BUF_IOCTL_SYNC \
28 _IOW(LOCAL_DMA_BUF_BASE, 0, struct local_dma_buf_sync)
29 #endif
30
18 using sandbox::SyscallSets; 31 using sandbox::SyscallSets;
19 using sandbox::bpf_dsl::Allow; 32 using sandbox::bpf_dsl::Allow;
20 using sandbox::bpf_dsl::Arg; 33 using sandbox::bpf_dsl::Arg;
21 using sandbox::bpf_dsl::Error; 34 using sandbox::bpf_dsl::Error;
22 using sandbox::bpf_dsl::ResultExpr; 35 using sandbox::bpf_dsl::ResultExpr;
23 36
24 namespace content { 37 namespace content {
25 38
26 namespace { 39 namespace {
27 40
28 ResultExpr RestrictIoctl() { 41 ResultExpr RestrictIoctl() {
29 const Arg<unsigned long> request(1); 42 const Arg<unsigned long> request(1);
30 return Switch(request) 43 return Switch(request)
31 .SANDBOX_BPF_DSL_CASES((static_cast<unsigned long>(TCGETS), FIONREAD), 44 .SANDBOX_BPF_DSL_CASES((static_cast<unsigned long>(TCGETS), FIONREAD),
32 Allow()) 45 Allow())
46 #if defined(OS_CHROMEOS)
47 .SANDBOX_BPF_DSL_CASES(
48 (static_cast<unsigned long>(LOCAL_DMA_BUF_IOCTL_SYNC)), Allow())
49 #endif
33 .Default(sandbox::CrashSIGSYSIoctl()); 50 .Default(sandbox::CrashSIGSYSIoctl());
34 } 51 }
35 52
36 } // namespace 53 } // namespace
37 54
38 RendererProcessPolicy::RendererProcessPolicy() {} 55 RendererProcessPolicy::RendererProcessPolicy() {}
39 RendererProcessPolicy::~RendererProcessPolicy() {} 56 RendererProcessPolicy::~RendererProcessPolicy() {}
40 57
41 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const { 58 ResultExpr RendererProcessPolicy::EvaluateSyscall(int sysno) const {
42 switch (sysno) { 59 switch (sysno) {
(...skipping 29 matching lines...) Expand all
72 return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno); 89 return sandbox::RestrictSchedTarget(GetPolicyPid(), sysno);
73 case __NR_prlimit64: 90 case __NR_prlimit64:
74 return Error(EPERM); // See crbug.com/160157. 91 return Error(EPERM); // See crbug.com/160157.
75 default: 92 default:
76 // Default on the content baseline policy. 93 // Default on the content baseline policy.
77 return SandboxBPFBasePolicy::EvaluateSyscall(sysno); 94 return SandboxBPFBasePolicy::EvaluateSyscall(sysno);
78 } 95 }
79 } 96 }
80 97
81 } // namespace content 98 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698