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

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: 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 18 matching lines...) Expand all
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 #endif 37 #endif
38 38
39 #if defined(USE_OZONE_GBM)
40 #include <drm.h>
41 #endif
42
39 #if defined(OS_ANDROID) 43 #if defined(OS_ANDROID)
40 44
41 #if !defined(F_DUPFD_CLOEXEC) 45 #if !defined(F_DUPFD_CLOEXEC)
42 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) 46 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
43 #endif 47 #endif
44 48
45 // https://android.googlesource.com/platform/bionic/+/lollipop-release/libc/priv ate/bionic_prctl.h 49 // https://android.googlesource.com/platform/bionic/+/lollipop-release/libc/priv ate/bionic_prctl.h
46 #if !defined(PR_SET_VMA) 50 #if !defined(PR_SET_VMA)
47 #define PR_SET_VMA 0x53564d41 51 #define PR_SET_VMA 0x53564d41
48 #endif 52 #endif
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return Switch(option) 146 return Switch(option)
143 .CASES((PR_GET_NAME, PR_SET_NAME, PR_GET_DUMPABLE, PR_SET_DUMPABLE), 147 .CASES((PR_GET_NAME, PR_SET_NAME, PR_GET_DUMPABLE, PR_SET_DUMPABLE),
144 Allow()) 148 Allow())
145 #if defined(OS_ANDROID) 149 #if defined(OS_ANDROID)
146 .CASES((PR_SET_VMA, PR_SET_TIMERSLACK_PID), Allow()) 150 .CASES((PR_SET_VMA, PR_SET_TIMERSLACK_PID), Allow())
147 #endif 151 #endif
148 .Default(CrashSIGSYSPrctl()); 152 .Default(CrashSIGSYSPrctl());
149 } 153 }
150 154
151 ResultExpr RestrictIoctl() { 155 ResultExpr RestrictIoctl() {
152 const Arg<int> request(1); 156 // The type of DRM_IOCTL_XXX macro is long unsigned int.
153 return Switch(request).CASES((TCGETS, FIONREAD), Allow()).Default( 157 #if defined(USE_OZONE_GBM)
154 CrashSIGSYSIoctl()); 158 auto reference_type = DRM_IOCTL_MODE_MAP_DUMB;
159 #else
160 auto reference_type = TCGETS;
161 #endif
162 const Arg<decltype(reference_type)> request(1);
163 return Switch(request)
164 .CASES(((decltype(reference_type))TCGETS, FIONREAD), Allow())
165 #if defined(USE_OZONE_GBM)
166 .CASES((DRM_IOCTL_GEM_CLOSE, DRM_IOCTL_MODE_DESTROY_DUMB,
167 DRM_IOCTL_MODE_MAP_DUMB, DRM_IOCTL_PRIME_FD_TO_HANDLE),
168 Allow())
169 #endif
170 .Default(CrashSIGSYSIoctl());
155 } 171 }
156 172
157 ResultExpr RestrictMmapFlags() { 173 ResultExpr RestrictMmapFlags() {
158 // The flags you see are actually the allowed ones, and the variable is a 174 // The flags you see are actually the allowed ones, and the variable is a
159 // "denied" mask because of the negation operator. 175 // "denied" mask because of the negation operator.
160 // Significantly, we don't permit MAP_HUGETLB, or the newer flags such as 176 // Significantly, we don't permit MAP_HUGETLB, or the newer flags such as
161 // MAP_POPULATE. 177 // MAP_POPULATE.
162 // TODO(davidung), remove MAP_DENYWRITE with updated Tegra libraries. 178 // TODO(davidung), remove MAP_DENYWRITE with updated Tegra libraries.
163 const uint64_t kAllowedMask = MAP_SHARED | MAP_PRIVATE | MAP_ANONYMOUS | 179 const uint64_t kAllowedMask = MAP_SHARED | MAP_PRIVATE | MAP_ANONYMOUS |
164 MAP_STACK | MAP_NORESERVE | MAP_FIXED | 180 MAP_STACK | MAP_NORESERVE | MAP_FIXED |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 clockid == base::TimeTicks::kClockSystemTrace || 323 clockid == base::TimeTicks::kClockSystemTrace ||
308 #endif 324 #endif
309 clockid == CLOCK_MONOTONIC || 325 clockid == CLOCK_MONOTONIC ||
310 clockid == CLOCK_PROCESS_CPUTIME_ID || 326 clockid == CLOCK_PROCESS_CPUTIME_ID ||
311 clockid == CLOCK_REALTIME || 327 clockid == CLOCK_REALTIME ||
312 clockid == CLOCK_THREAD_CPUTIME_ID, 328 clockid == CLOCK_THREAD_CPUTIME_ID,
313 Allow()).Else(CrashSIGSYS()); 329 Allow()).Else(CrashSIGSYS());
314 } 330 }
315 331
316 } // namespace sandbox. 332 } // namespace sandbox.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698