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. |
| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 // Device files needed by the Tegra GPU userspace. | 78 // Device files needed by the Tegra GPU userspace. |
| 79 static const char kDevNvhostCtrlPath[] = "/dev/nvhost-ctrl"; | 79 static const char kDevNvhostCtrlPath[] = "/dev/nvhost-ctrl"; |
| 80 static const char kDevNvhostIspPath[] = "/dev/nvhost-isp"; | 80 static const char kDevNvhostIspPath[] = "/dev/nvhost-isp"; |
| 81 static const char kDevNvhostViPath[] = "/dev/nvhost-vi"; | 81 static const char kDevNvhostViPath[] = "/dev/nvhost-vi"; |
| 82 static const char kDevNvmapPath[] = "/dev/nvmap"; | 82 static const char kDevNvmapPath[] = "/dev/nvmap"; |
| 83 static const char kDevNvhostGpuPath[] = "/dev/nvhost-gpu"; | 83 static const char kDevNvhostGpuPath[] = "/dev/nvhost-gpu"; |
| 84 static const char kDevNvhostAsGpuPath[] = "/dev/nvhost-as-gpu"; | 84 static const char kDevNvhostAsGpuPath[] = "/dev/nvhost-as-gpu"; |
| 85 static const char kDevNvhostCtrlGpuPath[] = "/dev/nvhost-ctrl-gpu"; | 85 static const char kDevNvhostCtrlGpuPath[] = "/dev/nvhost-ctrl-gpu"; |
| 86 static const char kSysDevicesSocIDPath[] = "/sys/devices/soc0/soc_id"; | 86 static const char kSysDevicesSocIDPath[] = "/sys/devices/soc0/soc_id"; |
| 87 static const char kSysDevicesSocRevPath[] = "/sys/devices/soc0/revision"; | 87 static const char kSysDevicesSocRevPath[] = "/sys/devices/soc0/revision"; |
| 88 static const char kDevNvavpPath[] = "/dev/tegra_avpchannel"; | |
| 89 static const char kDevVicPath[] = "/dev/nvhost-vic"; | |
| 88 // TODO(davidung): remove these device nodes before nyan launch. | 90 // TODO(davidung): remove these device nodes before nyan launch. |
| 89 | 91 |
| 90 read_whitelist->push_back(kDevNvhostCtrlPath); | 92 read_whitelist->push_back(kDevNvhostCtrlPath); |
| 91 read_whitelist->push_back(kDevNvhostIspPath); | 93 read_whitelist->push_back(kDevNvhostIspPath); |
| 92 read_whitelist->push_back(kDevNvhostViPath); | 94 read_whitelist->push_back(kDevNvhostViPath); |
| 93 read_whitelist->push_back(kDevNvmapPath); | 95 read_whitelist->push_back(kDevNvmapPath); |
| 94 read_whitelist->push_back(kDevNvhostGpuPath); | 96 read_whitelist->push_back(kDevNvhostGpuPath); |
| 95 read_whitelist->push_back(kDevNvhostAsGpuPath); | 97 read_whitelist->push_back(kDevNvhostAsGpuPath); |
| 96 read_whitelist->push_back(kDevNvhostCtrlGpuPath); | 98 read_whitelist->push_back(kDevNvhostCtrlGpuPath); |
| 97 read_whitelist->push_back(kSysDevicesSocIDPath); | 99 read_whitelist->push_back(kSysDevicesSocIDPath); |
| 98 read_whitelist->push_back(kSysDevicesSocRevPath); | 100 read_whitelist->push_back(kSysDevicesSocRevPath); |
| 101 read_whitelist->push_back(kDevNvavpPath); | |
| 102 read_whitelist->push_back(kDevVicPath); | |
| 99 | 103 |
| 100 write_whitelist->push_back(kDevNvhostCtrlPath); | 104 write_whitelist->push_back(kDevNvhostCtrlPath); |
| 101 write_whitelist->push_back(kDevNvhostIspPath); | 105 write_whitelist->push_back(kDevNvhostIspPath); |
| 102 write_whitelist->push_back(kDevNvhostViPath); | 106 write_whitelist->push_back(kDevNvhostViPath); |
| 103 write_whitelist->push_back(kDevNvmapPath); | 107 write_whitelist->push_back(kDevNvmapPath); |
| 104 write_whitelist->push_back(kDevNvhostGpuPath); | 108 write_whitelist->push_back(kDevNvhostGpuPath); |
| 105 write_whitelist->push_back(kDevNvhostAsGpuPath); | 109 write_whitelist->push_back(kDevNvhostAsGpuPath); |
| 106 write_whitelist->push_back(kDevNvhostCtrlGpuPath); | 110 write_whitelist->push_back(kDevNvhostCtrlGpuPath); |
| 111 write_whitelist->push_back(kDevNvavpPath); | |
| 112 write_whitelist->push_back(kDevVicPath); | |
|
shivdasp
2014/03/21 10:53:45
This whitelisting is only temporary and a change t
sheu
2014/03/21 23:19:54
I'd be inclined not to add whitelisting, even if t
shivdasp
2014/03/24 03:49:00
There's a race between this CL and another which r
| |
| 107 } | 113 } |
| 108 | 114 |
| 109 void AddArmGpuWhitelist(std::vector<std::string>* read_whitelist, | 115 void AddArmGpuWhitelist(std::vector<std::string>* read_whitelist, |
| 110 std::vector<std::string>* write_whitelist) { | 116 std::vector<std::string>* write_whitelist) { |
| 111 // On ARM we're enabling the sandbox before the X connection is made, | 117 // On ARM we're enabling the sandbox before the X connection is made, |
| 112 // so we need to allow access to |.Xauthority|. | 118 // so we need to allow access to |.Xauthority|. |
| 113 static const char kXAuthorityPath[] = "/home/chronos/.Xauthority"; | 119 static const char kXAuthorityPath[] = "/home/chronos/.Xauthority"; |
| 114 static const char kLdSoCache[] = "/etc/ld.so.cache"; | 120 static const char kLdSoCache[] = "/etc/ld.so.cache"; |
| 115 | 121 |
| 116 // Files needed by the ARM GPU userspace. | 122 // Files needed by the ARM GPU userspace. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 // Preload the Mali library. | 221 // Preload the Mali library. |
| 216 dlopen("/usr/lib/libmali.so", dlopen_flag); | 222 dlopen("/usr/lib/libmali.so", dlopen_flag); |
| 217 | 223 |
| 218 // Preload the Tegra libraries. | 224 // Preload the Tegra libraries. |
| 219 dlopen("/usr/lib/libnvrm.so", dlopen_flag); | 225 dlopen("/usr/lib/libnvrm.so", dlopen_flag); |
| 220 dlopen("/usr/lib/libnvrm_graphics.so", dlopen_flag); | 226 dlopen("/usr/lib/libnvrm_graphics.so", dlopen_flag); |
| 221 dlopen("/usr/lib/libnvidia-glsi.so", dlopen_flag); | 227 dlopen("/usr/lib/libnvidia-glsi.so", dlopen_flag); |
| 222 dlopen("/usr/lib/libnvidia-rmapi-tegra.so", dlopen_flag); | 228 dlopen("/usr/lib/libnvidia-rmapi-tegra.so", dlopen_flag); |
| 223 dlopen("/usr/lib/libnvidia-eglcore.so", dlopen_flag); | 229 dlopen("/usr/lib/libnvidia-eglcore.so", dlopen_flag); |
| 224 // TODO(davidung): remove these libraries before nyan launch. | 230 // TODO(davidung): remove these libraries before nyan launch. |
| 231 dlopen("/usr/lib/libtegrav4l2.so", dlopen_flag); | |
| 232 // Resetting errno since platform-specific libraries will fail on other | |
| 233 // platforms. | |
| 234 errno = 0; | |
| 225 | 235 |
| 226 return true; | 236 return true; |
| 227 } | 237 } |
| 228 | 238 |
| 229 } // namespace content | 239 } // namespace content |
| OLD | NEW |