| 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_cros_arm_gpu_policy_linux.h" | 5 #include "content/common/sandbox_linux/bpf_cros_arm_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> |
| 11 #include <sys/stat.h> | 11 #include <sys/stat.h> |
| 12 #include <sys/types.h> | 12 #include <sys/types.h> |
| 13 #include <unistd.h> | 13 #include <unistd.h> |
| 14 | 14 |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "base/bind.h" | 18 #include "base/bind.h" |
| 19 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" | 23 #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" |
| 24 #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h" | 24 #include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h" |
| 25 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" | 25 #include "sandbox/linux/seccomp-bpf-helpers/syscall_sets.h" |
| 26 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" | |
| 27 #include "sandbox/linux/services/linux_syscalls.h" | 26 #include "sandbox/linux/services/linux_syscalls.h" |
| 28 | 27 |
| 29 using sandbox::SyscallSets; | 28 using sandbox::SyscallSets; |
| 30 using sandbox::bpf_dsl::Allow; | 29 using sandbox::bpf_dsl::Allow; |
| 31 using sandbox::bpf_dsl::Arg; | 30 using sandbox::bpf_dsl::Arg; |
| 32 using sandbox::bpf_dsl::Error; | 31 using sandbox::bpf_dsl::Error; |
| 33 using sandbox::bpf_dsl::If; | 32 using sandbox::bpf_dsl::If; |
| 34 using sandbox::bpf_dsl::ResultExpr; | 33 using sandbox::bpf_dsl::ResultExpr; |
| 35 | 34 |
| 36 namespace content { | 35 namespace content { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 read_whitelist->push_back(kXAuthorityPath); | 89 read_whitelist->push_back(kXAuthorityPath); |
| 91 read_whitelist->push_back(kLdSoCache); | 90 read_whitelist->push_back(kLdSoCache); |
| 92 read_whitelist->push_back(kLibGlesPath); | 91 read_whitelist->push_back(kLibGlesPath); |
| 93 read_whitelist->push_back(kLibEglPath); | 92 read_whitelist->push_back(kLibEglPath); |
| 94 | 93 |
| 95 AddArmMaliGpuWhitelist(read_whitelist, write_whitelist); | 94 AddArmMaliGpuWhitelist(read_whitelist, write_whitelist); |
| 96 } | 95 } |
| 97 | 96 |
| 98 class CrosArmGpuBrokerProcessPolicy : public CrosArmGpuProcessPolicy { | 97 class CrosArmGpuBrokerProcessPolicy : public CrosArmGpuProcessPolicy { |
| 99 public: | 98 public: |
| 100 static sandbox::SandboxBPFPolicy* Create() { | 99 static sandbox::bpf_dsl::SandboxBPFDSLPolicy* Create() { |
| 101 return new CrosArmGpuBrokerProcessPolicy(); | 100 return new CrosArmGpuBrokerProcessPolicy(); |
| 102 } | 101 } |
| 103 virtual ~CrosArmGpuBrokerProcessPolicy() {} | 102 virtual ~CrosArmGpuBrokerProcessPolicy() {} |
| 104 | 103 |
| 105 virtual ResultExpr EvaluateSyscall(int system_call_number) const OVERRIDE; | 104 virtual ResultExpr EvaluateSyscall(int system_call_number) const OVERRIDE; |
| 106 | 105 |
| 107 private: | 106 private: |
| 108 CrosArmGpuBrokerProcessPolicy() : CrosArmGpuProcessPolicy(false) {} | 107 CrosArmGpuBrokerProcessPolicy() : CrosArmGpuProcessPolicy(false) {} |
| 109 DISALLOW_COPY_AND_ASSIGN(CrosArmGpuBrokerProcessPolicy); | 108 DISALLOW_COPY_AND_ASSIGN(CrosArmGpuBrokerProcessPolicy); |
| 110 }; | 109 }; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // Preload the Tegra V4L2 (video decode acceleration) library. | 181 // Preload the Tegra V4L2 (video decode acceleration) library. |
| 183 dlopen("/usr/lib/libtegrav4l2.so", dlopen_flag); | 182 dlopen("/usr/lib/libtegrav4l2.so", dlopen_flag); |
| 184 // Resetting errno since platform-specific libraries will fail on other | 183 // Resetting errno since platform-specific libraries will fail on other |
| 185 // platforms. | 184 // platforms. |
| 186 errno = 0; | 185 errno = 0; |
| 187 | 186 |
| 188 return true; | 187 return true; |
| 189 } | 188 } |
| 190 | 189 |
| 191 } // namespace content | 190 } // namespace content |
| OLD | NEW |