OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_BPF_GPU_POLICY_LINUX_H_ | |
6 #define CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_BPF_GPU_POLICY_LINUX_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h" | |
12 | |
13 namespace sandbox { | |
14 class BrokerProcess; | |
15 } | |
16 | |
17 namespace content { | |
18 | |
19 class GpuProcessPolicy : public SandboxBPFBasePolicy { | |
20 public: | |
21 GpuProcessPolicy() : broker_process_(NULL) {} | |
Robert Sesek
2013/12/12 21:33:48
Same out-of-line the dtor/ctor.
jln (very slow on Chromium)
2013/12/12 22:15:14
Done.
| |
22 virtual ~GpuProcessPolicy() {} | |
23 | |
24 virtual ErrorCode EvaluateSyscall(SandboxBPF* sandbox_compiler, | |
25 int system_call_number) const OVERRIDE; | |
26 virtual bool PreSandboxHook() OVERRIDE; | |
27 | |
28 protected: | |
29 // Start a broker process to handle open() inside the sandbox. | |
30 // |broker_sandboxer_callback| is a callback that will enable a suitable | |
31 // sandbox for the broker process itself. | |
32 // |read_whitelist_extra| and |write_whitelist_extra| are lists of file | |
33 // names that should be whitelisted by the broker process, in addition to | |
34 // the basic ones. | |
35 void InitGpuBrokerProcess( | |
36 bool (*broker_sandboxer_callback)(void), | |
Robert Sesek
2013/12/12 21:33:48
Could/should this be a base::Callback?
jln (very slow on Chromium)
2013/12/12 22:15:14
We could do that. That will require changing the B
Robert Sesek
2013/12/13 01:39:15
Don't feel strongly, was just thinking aloud.
| |
37 const std::vector<std::string>& read_whitelist_extra, | |
38 const std::vector<std::string>& write_whitelist_extra); | |
Robert Sesek
2013/12/12 21:33:48
nit: blank line after
jln (very slow on Chromium)
2013/12/12 22:15:14
Done.
| |
39 sandbox::BrokerProcess* broker_process() { return broker_process_; } | |
40 | |
41 private: | |
42 // A BrokerProcess is a helper that is started before the sandbox is engaged | |
43 // and will serve requests to access files over an IPC. The client of this | |
44 // runs from a SIGSYS handler triggered by the seccomp-bpf sandbox. | |
45 // This should never be destroyed, as after the sandbox is started it is | |
46 // vital to the process. | |
47 // This is allocated by InitGpuBrokerProcess, called from PreSandboxHook(), | |
48 // which executes iff the sandbox is going to be enabled afterwards. | |
49 sandbox::BrokerProcess* broker_process_; | |
50 DISALLOW_COPY_AND_ASSIGN(GpuProcessPolicy); | |
51 }; | |
52 | |
53 } // namespace content | |
54 | |
55 #endif // CONTENT_COMMON_SANDBOX_LINUX_SANDBOX_BPF_GPU_POLICY_LINUX_H_ | |
OLD | NEW |