| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 case __NR_sched_getaffinity: | 178 case __NR_sched_getaffinity: |
| 179 case __NR_sched_setaffinity: | 179 case __NR_sched_setaffinity: |
| 180 case __NR_setpriority: | 180 case __NR_setpriority: |
| 181 return ErrorCode(ErrorCode::ERR_ALLOWED); | 181 return ErrorCode(ErrorCode::ERR_ALLOWED); |
| 182 case __NR_access: | 182 case __NR_access: |
| 183 case __NR_open: | 183 case __NR_open: |
| 184 case __NR_openat: | 184 case __NR_openat: |
| 185 DCHECK(broker_process_); | 185 DCHECK(broker_process_); |
| 186 return sandbox->Trap(GpuSIGSYS_Handler, broker_process_); | 186 return sandbox->Trap(GpuSIGSYS_Handler, broker_process_); |
| 187 default: | 187 default: |
| 188 // Allow *kill from the GPU process temporarily until fork() |
| 189 // is denied here. |
| 190 if (SyscallSets::IsKill(sysno)) |
| 191 return ErrorCode(ErrorCode::ERR_ALLOWED); |
| 188 if (SyscallSets::IsEventFd(sysno)) | 192 if (SyscallSets::IsEventFd(sysno)) |
| 189 return ErrorCode(ErrorCode::ERR_ALLOWED); | 193 return ErrorCode(ErrorCode::ERR_ALLOWED); |
| 190 | 194 |
| 191 // Default on the baseline policy. | 195 // Default on the baseline policy. |
| 192 return SandboxBPFBasePolicy::EvaluateSyscall(sandbox, sysno); | 196 return SandboxBPFBasePolicy::EvaluateSyscall(sandbox, sysno); |
| 193 } | 197 } |
| 194 } | 198 } |
| 195 | 199 |
| 196 bool GpuProcessPolicy::PreSandboxHook() { | 200 bool GpuProcessPolicy::PreSandboxHook() { |
| 197 // Warm up resources needed by the policy we're about to enable and | 201 // Warm up resources needed by the policy we're about to enable and |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), | 260 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), |
| 257 read_whitelist, | 261 read_whitelist, |
| 258 write_whitelist); | 262 write_whitelist); |
| 259 // The initialization callback will perform generic initialization and then | 263 // The initialization callback will perform generic initialization and then |
| 260 // call broker_sandboxer_callback. | 264 // call broker_sandboxer_callback. |
| 261 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, | 265 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, |
| 262 broker_sandboxer_allocator))); | 266 broker_sandboxer_allocator))); |
| 263 } | 267 } |
| 264 | 268 |
| 265 } // namespace content | 269 } // namespace content |
| OLD | NEW |