OLD | NEW |
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 "content/common/sandbox_linux/bpf_gpu_policy_linux.h" | 5 #include "content/common/sandbox_linux/bpf_gpu_policy_linux.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } // namespace | 159 } // namespace |
160 | 160 |
161 GpuProcessPolicy::GpuProcessPolicy() : broker_process_(NULL) {} | 161 GpuProcessPolicy::GpuProcessPolicy() : broker_process_(NULL) {} |
162 | 162 |
163 GpuProcessPolicy::~GpuProcessPolicy() {} | 163 GpuProcessPolicy::~GpuProcessPolicy() {} |
164 | 164 |
165 // Main policy for x86_64/i386. Extended by CrosArmGpuProcessPolicy. | 165 // Main policy for x86_64/i386. Extended by CrosArmGpuProcessPolicy. |
166 ErrorCode GpuProcessPolicy::EvaluateSyscall(SandboxBPF* sandbox, | 166 ErrorCode GpuProcessPolicy::EvaluateSyscall(SandboxBPF* sandbox, |
167 int sysno) const { | 167 int sysno) const { |
168 switch (sysno) { | 168 switch (sysno) { |
| 169 // TODO(jln): restrict clone. |
| 170 case __NR_clone: |
169 case __NR_ioctl: | 171 case __NR_ioctl: |
170 #if defined(__i386__) || defined(__x86_64__) | 172 #if defined(__i386__) || defined(__x86_64__) |
171 // The Nvidia driver uses flags not in the baseline policy | 173 // The Nvidia driver uses flags not in the baseline policy |
172 // (MAP_LOCKED | MAP_EXECUTABLE | MAP_32BIT) | 174 // (MAP_LOCKED | MAP_EXECUTABLE | MAP_32BIT) |
173 case __NR_mmap: | 175 case __NR_mmap: |
174 #endif | 176 #endif |
175 // We also hit this on the linux_chromeos bot but don't yet know what | 177 // We also hit this on the linux_chromeos bot but don't yet know what |
176 // weird flags were involved. | 178 // weird flags were involved. |
177 case __NR_mprotect: | 179 case __NR_mprotect: |
178 case __NR_sched_getaffinity: | 180 case __NR_sched_getaffinity: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), | 262 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), |
261 read_whitelist, | 263 read_whitelist, |
262 write_whitelist); | 264 write_whitelist); |
263 // The initialization callback will perform generic initialization and then | 265 // The initialization callback will perform generic initialization and then |
264 // call broker_sandboxer_callback. | 266 // call broker_sandboxer_callback. |
265 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, | 267 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, |
266 broker_sandboxer_allocator))); | 268 broker_sandboxer_allocator))); |
267 } | 269 } |
268 | 270 |
269 } // namespace content | 271 } // namespace content |
OLD | NEW |