Chromium Code Reviews| 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. |
|
wuchengli
2015/01/05 08:42:44
This CL doesn't add the permission for all x86. Pl
| |
| 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> |
| (...skipping 38 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 // Device nodes for V4L2 video decode accelerator drivers. | |
| 63 static const char kDevVideoDecPath[] = "/dev/video-dec"; | |
| 64 | |
| 65 // Video processor used on ARM Exynos platforms. | 62 // Video processor used on ARM Exynos platforms. |
| 66 static const char kDevGsc1Path[] = "/dev/gsc1"; | 63 static const char kDevGsc1Path[] = "/dev/gsc1"; |
| 67 | 64 |
| 68 // Device nodes for V4L2 video encode accelerator drivers. | |
| 69 static const char kDevVideoEncPath[] = "/dev/video-enc"; | |
| 70 | |
| 71 permissions->push_back(BrokerFilePermission::ReadWrite(kMali0Path)); | 65 permissions->push_back(BrokerFilePermission::ReadWrite(kMali0Path)); |
| 72 permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoDecPath)); | |
| 73 permissions->push_back(BrokerFilePermission::ReadWrite(kDevGsc1Path)); | 66 permissions->push_back(BrokerFilePermission::ReadWrite(kDevGsc1Path)); |
| 74 permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoEncPath)); | |
| 75 } | 67 } |
| 76 | 68 |
| 77 void AddArmGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { | 69 void AddArmGpuWhitelist(std::vector<BrokerFilePermission>* permissions) { |
| 78 // On ARM we're enabling the sandbox before the X connection is made, | 70 // On ARM we're enabling the sandbox before the X connection is made, |
| 79 // so we need to allow access to |.Xauthority|. | 71 // so we need to allow access to |.Xauthority|. |
| 80 static const char kXAuthorityPath[] = "/home/chronos/.Xauthority"; | 72 static const char kXAuthorityPath[] = "/home/chronos/.Xauthority"; |
| 81 static const char kLdSoCache[] = "/etc/ld.so.cache"; | 73 static const char kLdSoCache[] = "/etc/ld.so.cache"; |
| 82 | 74 |
| 83 // Files needed by the ARM GPU userspace. | 75 // Files needed by the ARM GPU userspace. |
| 84 static const char kLibGlesPath[] = "/usr/lib/libGLESv2.so.2"; | 76 static const char kLibGlesPath[] = "/usr/lib/libGLESv2.so.2"; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 // Preload the Tegra V4L2 (video decode acceleration) library. | 168 // Preload the Tegra V4L2 (video decode acceleration) library. |
| 177 dlopen("/usr/lib/libtegrav4l2.so", dlopen_flag); | 169 dlopen("/usr/lib/libtegrav4l2.so", dlopen_flag); |
| 178 // Resetting errno since platform-specific libraries will fail on other | 170 // Resetting errno since platform-specific libraries will fail on other |
| 179 // platforms. | 171 // platforms. |
| 180 errno = 0; | 172 errno = 0; |
| 181 | 173 |
| 182 return true; | 174 return true; |
| 183 } | 175 } |
| 184 | 176 |
| 185 } // namespace content | 177 } // namespace content |
| OLD | NEW |