| 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> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 return true; | 52 return true; |
| 53 #else | 53 #else |
| 54 return false; | 54 return false; |
| 55 #endif | 55 #endif |
| 56 } | 56 } |
| 57 | 57 |
| 58 void AddArmMaliGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { | 58 void AddArmMaliGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { |
| 59 // Device file needed by the ARM GPU userspace. | 59 // Device file needed by the ARM GPU userspace. |
| 60 static const char kMali0Path[] = "/dev/mali0"; | 60 static const char kMali0Path[] = "/dev/mali0"; |
| 61 | 61 |
| 62 // Devices needed for video decode acceleration on ARM. | 62 // Devices nodes for V4L2 video decode accelerator drivers. |
| 63 static const char kDevMfcDecPath[] = "/dev/mfc-dec"; | 63 static const char kDevVideoDecPath[] = "/dev/video-dec"; |
| 64 |
| 65 // Video processor used on ARM Exynos platforms. |
| 64 static const char kDevGsc1Path[] = "/dev/gsc1"; | 66 static const char kDevGsc1Path[] = "/dev/gsc1"; |
| 65 | 67 |
| 66 // Devices needed for video encode acceleration on ARM. | 68 // Devices nodes for V4L2 video encode accelerator drivers. |
| 67 static const char kDevMfcEncPath[] = "/dev/mfc-enc"; | 69 static const char kDevVideoEncPath[] = "/dev/video-enc"; |
| 68 | 70 |
| 69 permissions->push_back(BrokerFilePermission::ReadWrite(kMali0Path)); | 71 permissions->push_back(BrokerFilePermission::ReadWrite(kMali0Path)); |
| 70 permissions->push_back(BrokerFilePermission::ReadWrite(kDevMfcDecPath)); | 72 permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoDecPath)); |
| 71 permissions->push_back(BrokerFilePermission::ReadWrite(kDevGsc1Path)); | 73 permissions->push_back(BrokerFilePermission::ReadWrite(kDevGsc1Path)); |
| 72 permissions->push_back(BrokerFilePermission::ReadWrite(kDevMfcEncPath)); | 74 permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoEncPath)); |
| 73 } | 75 } |
| 74 | 76 |
| 75 void AddArmGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { | 77 void AddArmGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { |
| 76 // On ARM we're enabling the sandbox before the X connection is made, | 78 // On ARM we're enabling the sandbox before the X connection is made, |
| 77 // so we need to allow access to |.Xauthority|. | 79 // so we need to allow access to |.Xauthority|. |
| 78 static const char kXAuthorityPath[] = "/home/chronos/.Xauthority"; | 80 static const char kXAuthorityPath[] = "/home/chronos/.Xauthority"; |
| 79 static const char kLdSoCache[] = "/etc/ld.so.cache"; | 81 static const char kLdSoCache[] = "/etc/ld.so.cache"; |
| 80 | 82 |
| 81 // Files needed by the ARM GPU userspace. | 83 // Files needed by the ARM GPU userspace. |
| 82 static const char kLibGlesPath[] = "/usr/lib/libGLESv2.so.2"; | 84 static const char kLibGlesPath[] = "/usr/lib/libGLESv2.so.2"; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Preload the Tegra V4L2 (video decode acceleration) library. | 173 // Preload the Tegra V4L2 (video decode acceleration) library. |
| 172 dlopen("/usr/lib/libtegrav4l2.so", dlopen_flag); | 174 dlopen("/usr/lib/libtegrav4l2.so", dlopen_flag); |
| 173 // Resetting errno since platform-specific libraries will fail on other | 175 // Resetting errno since platform-specific libraries will fail on other |
| 174 // platforms. | 176 // platforms. |
| 175 errno = 0; | 177 errno = 0; |
| 176 | 178 |
| 177 return true; | 179 return true; |
| 178 } | 180 } |
| 179 | 181 |
| 180 } // namespace content | 182 } // namespace content |
| OLD | NEW |