Add ICU message format support
[chromium-blink-merge.git] / mojo / runner / linux_sandbox.h
blob4111cf5860065e1b7ccd698d84a33fd1cead6bcb
1 // Copyright 2015 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.
5 #ifndef MOJO_RUNNER_LINUX_SANDBOX_H_
6 #define MOJO_RUNNER_LINUX_SANDBOX_H_
8 #include "base/files/scoped_file.h"
9 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
10 #include "sandbox/linux/bpf_dsl/policy.h"
11 #include "sandbox/linux/syscall_broker/broker_process.h"
13 namespace mandoline {
15 // Encapsulates all tasks related to raising the sandbox for mandoline.
16 class LinuxSandbox {
17 public:
18 explicit LinuxSandbox(
19 const std::vector<sandbox::syscall_broker::BrokerFilePermission>&
20 permissions);
21 ~LinuxSandbox();
23 // Grabs a file descriptor to /proc.
24 void Warmup();
26 // Puts the user in a new PID namespace.
27 void EngageNamespaceSandbox();
29 // Starts a broker process and sets up seccomp-bpf to delegate decisions to
30 // it.
31 void EngageSeccompSandbox();
33 // Performs the dropping of access to the outside world (drops the reference
34 // to /proc acquired in Warmup().
35 void Seal();
37 private:
38 bool warmed_up_;
39 base::ScopedFD proc_fd_;
40 scoped_ptr<sandbox::syscall_broker::BrokerProcess> broker_;
41 scoped_ptr<sandbox::bpf_dsl::Policy> policy_;
43 DISALLOW_COPY_AND_ASSIGN(LinuxSandbox);
46 } // namespace mandoline
48 #endif // MOJO_RUNNER_LINUX_SANDBOX_H_