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

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

Issue 1253363004: ozone gbm: whitelist 3 DRM ioctl code for native GpuMemoryBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use "unsigned int" Created 5 years, 4 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 | « sandbox/linux/sandbox_linux.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17 matching lines...) Expand all
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 #include "sandbox/linux/system_headers/linux_time.h" 33 #include "sandbox/linux/system_headers/linux_time.h"
34 34
35 // PNaCl toolchain does not provide sys/ioctl.h header. 35 // PNaCl toolchain does not provide sys/ioctl.h header.
36 #if !defined(OS_NACL_NONSFI) 36 #if !defined(OS_NACL_NONSFI)
37 #include <sys/ioctl.h> 37 #include <sys/ioctl.h>
38 #if defined(USE_VGEM_MAP)
39 #include <libdrm/vgem_drm.h>
40 #endif
38 #endif 41 #endif
39 42
40 #if defined(OS_ANDROID) 43 #if defined(OS_ANDROID)
41 44
42 #if !defined(F_DUPFD_CLOEXEC) 45 #if !defined(F_DUPFD_CLOEXEC)
43 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6) 46 #define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
44 #endif 47 #endif
45 48
46 // 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
47 #if !defined(PR_SET_VMA) 50 #if !defined(PR_SET_VMA)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return Switch(option) 146 return Switch(option)
144 .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),
145 Allow()) 148 Allow())
146 #if defined(OS_ANDROID) 149 #if defined(OS_ANDROID)
147 .CASES((PR_SET_VMA, PR_SET_TIMERSLACK_PID), Allow()) 150 .CASES((PR_SET_VMA, PR_SET_TIMERSLACK_PID), Allow())
148 #endif 151 #endif
149 .Default(CrashSIGSYSPrctl()); 152 .Default(CrashSIGSYSPrctl());
150 } 153 }
151 154
152 ResultExpr RestrictIoctl() { 155 ResultExpr RestrictIoctl() {
153 const Arg<int> request(1); 156 const Arg<unsigned int> request(1);
154 return Switch(request).CASES((TCGETS, FIONREAD), Allow()).Default( 157 return Switch(request)
155 CrashSIGSYSIoctl()); 158 .CASES((static_cast<unsigned int>(TCGETS), FIONREAD), Allow())
spang 2015/08/21 17:28:51 Why unsigned int rather than unsigned long? The ac
mdempsky 2015/08/21 17:39:47 Annoying. POSIX and the Linux man pages say reque
dshwang 2015/08/21 18:26:33 Thx for investigation. I rollback this code to ens
159 #if defined(USE_VGEM_MAP)
160 .CASES((DRM_IOCTL_GEM_CLOSE, DRM_IOCTL_VGEM_MODE_MAP_DUMB,
161 DRM_IOCTL_PRIME_FD_TO_HANDLE),
162 Allow())
163 #endif
164 .Default(CrashSIGSYSIoctl());
156 } 165 }
157 166
158 ResultExpr RestrictMmapFlags() { 167 ResultExpr RestrictMmapFlags() {
159 // The flags you see are actually the allowed ones, and the variable is a 168 // The flags you see are actually the allowed ones, and the variable is a
160 // "denied" mask because of the negation operator. 169 // "denied" mask because of the negation operator.
161 // Significantly, we don't permit MAP_HUGETLB, or the newer flags such as 170 // Significantly, we don't permit MAP_HUGETLB, or the newer flags such as
162 // MAP_POPULATE. 171 // MAP_POPULATE.
163 // TODO(davidung), remove MAP_DENYWRITE with updated Tegra libraries. 172 // TODO(davidung), remove MAP_DENYWRITE with updated Tegra libraries.
164 const uint64_t kAllowedMask = MAP_SHARED | MAP_PRIVATE | MAP_ANONYMOUS | 173 const uint64_t kAllowedMask = MAP_SHARED | MAP_PRIVATE | MAP_ANONYMOUS |
165 MAP_STACK | MAP_NORESERVE | MAP_FIXED | 174 MAP_STACK | MAP_NORESERVE | MAP_FIXED |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 clockid == CLOCK_MONOTONIC || 319 clockid == CLOCK_MONOTONIC ||
311 clockid == CLOCK_MONOTONIC_COARSE || 320 clockid == CLOCK_MONOTONIC_COARSE ||
312 clockid == CLOCK_PROCESS_CPUTIME_ID || 321 clockid == CLOCK_PROCESS_CPUTIME_ID ||
313 clockid == CLOCK_REALTIME || 322 clockid == CLOCK_REALTIME ||
314 clockid == CLOCK_REALTIME_COARSE || 323 clockid == CLOCK_REALTIME_COARSE ||
315 clockid == CLOCK_THREAD_CPUTIME_ID, 324 clockid == CLOCK_THREAD_CPUTIME_ID,
316 Allow()).Else(CrashSIGSYS()); 325 Allow()).Else(CrashSIGSYS());
317 } 326 }
318 327
319 } // namespace sandbox. 328 } // namespace sandbox.
OLDNEW
« no previous file with comments | « sandbox/linux/sandbox_linux.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698