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

Side by Side Diff: sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc

Issue 1134993003: ozone: Implement zero/one-copy texture for Ozone GBM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: not-leak USE_OZONE_GBM, GetSupportedGpuMemoryBufferConfigurations from ozone, return handle Created 5 years, 7 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 "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h" 5 #include "sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <linux/net.h> 10 #include <linux/net.h>
(...skipping 16 matching lines...) Expand all
27 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" 27 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
28 #include "sandbox/linux/bpf_dsl/seccomp_macros.h" 28 #include "sandbox/linux/bpf_dsl/seccomp_macros.h"
29 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h" 29 #include "sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.h"
30 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" 30 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
31 #include "sandbox/linux/system_headers/linux_futex.h" 31 #include "sandbox/linux/system_headers/linux_futex.h"
32 #include "sandbox/linux/system_headers/linux_syscalls.h" 32 #include "sandbox/linux/system_headers/linux_syscalls.h"
33 33
34 // PNaCl toolchain does not provide sys/ioctl.h header. 34 // PNaCl toolchain does not provide sys/ioctl.h header.
35 #if !defined(OS_NACL_NONSFI) 35 #if !defined(OS_NACL_NONSFI)
36 #include <sys/ioctl.h> 36 #include <sys/ioctl.h>
37 #if defined(USE_OZONE)
38 #include <drm.h>
39 #endif
37 #endif 40 #endif
38 41
39 #if defined(OS_ANDROID) 42 #if defined(OS_ANDROID)
40 43
41 #if !defined(F_DUPFD_CLOEXEC) 44 #if !defined(F_DUPFD_CLOEXEC)
42 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) 45 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
43 #endif 46 #endif
44 47
45 // https://android.googlesource.com/platform/bionic/+/lollipop-release/libc/priv ate/bionic_prctl.h 48 // https://android.googlesource.com/platform/bionic/+/lollipop-release/libc/priv ate/bionic_prctl.h
46 #if !defined(PR_SET_VMA) 49 #if !defined(PR_SET_VMA)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return Switch(option) 145 return Switch(option)
143 .CASES((PR_GET_NAME, PR_SET_NAME, PR_GET_DUMPABLE, PR_SET_DUMPABLE), 146 .CASES((PR_GET_NAME, PR_SET_NAME, PR_GET_DUMPABLE, PR_SET_DUMPABLE),
144 Allow()) 147 Allow())
145 #if defined(OS_ANDROID) 148 #if defined(OS_ANDROID)
146 .CASES((PR_SET_VMA, PR_SET_TIMERSLACK_PID), Allow()) 149 .CASES((PR_SET_VMA, PR_SET_TIMERSLACK_PID), Allow())
147 #endif 150 #endif
148 .Default(CrashSIGSYSPrctl()); 151 .Default(CrashSIGSYSPrctl());
149 } 152 }
150 153
151 ResultExpr RestrictIoctl() { 154 ResultExpr RestrictIoctl() {
152 const Arg<int> request(1); 155 // The type of DRM_IOCTL_XXX macro is long unsigned int.
153 return Switch(request).CASES((TCGETS, FIONREAD), Allow()).Default( 156 #if defined(USE_OZONE)
154 CrashSIGSYSIoctl()); 157 auto reference_type = DRM_IOCTL_MODE_MAP_DUMB;
158 #else
159 auto reference_type = TCGETS;
160 #endif
161 const Arg<decltype(reference_type)> request(1);
162 return Switch(request)
163 .CASES(((decltype(reference_type))TCGETS, FIONREAD), Allow())
164 #if defined(USE_OZONE)
165 .CASES((DRM_IOCTL_GEM_CLOSE, DRM_IOCTL_MODE_DESTROY_DUMB,
166 DRM_IOCTL_MODE_MAP_DUMB, DRM_IOCTL_PRIME_FD_TO_HANDLE),
167 Allow())
168 #endif
169 .Default(CrashSIGSYSIoctl());
155 } 170 }
156 171
157 ResultExpr RestrictMmapFlags() { 172 ResultExpr RestrictMmapFlags() {
158 // The flags you see are actually the allowed ones, and the variable is a 173 // The flags you see are actually the allowed ones, and the variable is a
159 // "denied" mask because of the negation operator. 174 // "denied" mask because of the negation operator.
160 // Significantly, we don't permit MAP_HUGETLB, or the newer flags such as 175 // Significantly, we don't permit MAP_HUGETLB, or the newer flags such as
161 // MAP_POPULATE. 176 // MAP_POPULATE.
162 // TODO(davidung), remove MAP_DENYWRITE with updated Tegra libraries. 177 // TODO(davidung), remove MAP_DENYWRITE with updated Tegra libraries.
163 const uint64_t kAllowedMask = MAP_SHARED | MAP_PRIVATE | MAP_ANONYMOUS | 178 const uint64_t kAllowedMask = MAP_SHARED | MAP_PRIVATE | MAP_ANONYMOUS |
164 MAP_STACK | MAP_NORESERVE | MAP_FIXED | 179 MAP_STACK | MAP_NORESERVE | MAP_FIXED |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 clockid == base::TimeTicks::kClockSystemTrace || 322 clockid == base::TimeTicks::kClockSystemTrace ||
308 #endif 323 #endif
309 clockid == CLOCK_MONOTONIC || 324 clockid == CLOCK_MONOTONIC ||
310 clockid == CLOCK_PROCESS_CPUTIME_ID || 325 clockid == CLOCK_PROCESS_CPUTIME_ID ||
311 clockid == CLOCK_REALTIME || 326 clockid == CLOCK_REALTIME ||
312 clockid == CLOCK_THREAD_CPUTIME_ID, 327 clockid == CLOCK_THREAD_CPUTIME_ID,
313 Allow()).Else(CrashSIGSYS()); 328 Allow()).Else(CrashSIGSYS());
314 } 329 }
315 330
316 } // namespace sandbox. 331 } // namespace sandbox.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698