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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 void AddV4L2GpuWhitelist(std::vector<BrokerFilePermission>* permissions) { | 153 void AddV4L2GpuWhitelist(std::vector<BrokerFilePermission>* permissions) { |
154 if (IsAcceleratedVideoDecodeEnabled()) { | 154 if (IsAcceleratedVideoDecodeEnabled()) { |
155 // Device node for V4L2 video decode accelerator drivers. | 155 // Device node for V4L2 video decode accelerator drivers. |
156 static const char kDevVideoDecPath[] = "/dev/video-dec"; | 156 static const char kDevVideoDecPath[] = "/dev/video-dec"; |
157 permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoDecPath)); | 157 permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoDecPath)); |
158 } | 158 } |
159 | 159 |
160 // Device node for V4L2 video encode accelerator drivers. | 160 // Device node for V4L2 video encode accelerator drivers. |
161 static const char kDevVideoEncPath[] = "/dev/video-enc"; | 161 static const char kDevVideoEncPath[] = "/dev/video-enc"; |
162 permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoEncPath)); | 162 permissions->push_back(BrokerFilePermission::ReadWrite(kDevVideoEncPath)); |
| 163 |
| 164 // Device node for V4L2 JPEG decode accelerator drivers. |
| 165 static const char kDevJpegDecPath[] = "/dev/jpeg-dec"; |
| 166 permissions->push_back(BrokerFilePermission::ReadWrite(kDevJpegDecPath)); |
163 } | 167 } |
164 | 168 |
165 class GpuBrokerProcessPolicy : public GpuProcessPolicy { | 169 class GpuBrokerProcessPolicy : public GpuProcessPolicy { |
166 public: | 170 public: |
167 static sandbox::bpf_dsl::Policy* Create() { | 171 static sandbox::bpf_dsl::Policy* Create() { |
168 return new GpuBrokerProcessPolicy(); | 172 return new GpuBrokerProcessPolicy(); |
169 } | 173 } |
170 ~GpuBrokerProcessPolicy() override {} | 174 ~GpuBrokerProcessPolicy() override {} |
171 | 175 |
172 ResultExpr EvaluateSyscall(int system_call_number) const override; | 176 ResultExpr EvaluateSyscall(int system_call_number) const override; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 354 } |
351 | 355 |
352 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), permissions); | 356 broker_process_ = new BrokerProcess(GetFSDeniedErrno(), permissions); |
353 // The initialization callback will perform generic initialization and then | 357 // The initialization callback will perform generic initialization and then |
354 // call broker_sandboxer_callback. | 358 // call broker_sandboxer_callback. |
355 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, | 359 CHECK(broker_process_->Init(base::Bind(&UpdateProcessTypeAndEnableSandbox, |
356 broker_sandboxer_allocator))); | 360 broker_sandboxer_allocator))); |
357 } | 361 } |
358 | 362 |
359 } // namespace content | 363 } // namespace content |
OLD | NEW |