Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: mandoline/app/desktop/linux_sandbox.h

Issue 1264463005: mandoline sandbox: prewarm libraries before we raise the sandbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mandoline/app/desktop/linux_sandbox.cc » ('j') | mandoline/app/desktop/main.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef MANDOLINE_APP_DESKTOP_LINUX_SANDBOX_H_ 5 #ifndef MANDOLINE_APP_DESKTOP_LINUX_SANDBOX_H_
6 #define MANDOLINE_APP_DESKTOP_LINUX_SANDBOX_H_ 6 #define MANDOLINE_APP_DESKTOP_LINUX_SANDBOX_H_
7 7
8 #include "base/files/scoped_file.h" 8 #include "base/files/scoped_file.h"
9 #include "sandbox/linux/bpf_dsl/bpf_dsl.h" 9 #include "sandbox/linux/bpf_dsl/bpf_dsl.h"
10 #include "sandbox/linux/bpf_dsl/policy.h" 10 #include "sandbox/linux/bpf_dsl/policy.h"
11 #include "sandbox/linux/syscall_broker/broker_process.h" 11 #include "sandbox/linux/syscall_broker/broker_process.h"
12 12
13 namespace mandoline { 13 namespace mandoline {
14 14
15 // Encapsulates all tasks related to raising the sandbox for mandoline. 15 // Encapsulates all tasks related to raising the sandbox for mandoline.
16 class LinuxSandbox { 16 class LinuxSandbox {
17 public: 17 public:
18 explicit LinuxSandbox( 18 explicit LinuxSandbox(
19 const std::vector<sandbox::syscall_broker::BrokerFilePermission>& 19 const std::vector<sandbox::syscall_broker::BrokerFilePermission>&
20 permissions); 20 permissions);
21 ~LinuxSandbox(); 21 ~LinuxSandbox();
22 22
23 // Returns a vector of file permissions needed to load libraries.
24 static std::vector<sandbox::syscall_broker::BrokerFilePermission>
25 GetPermissions();
26
27 // Grabs a file descriptor to /proc. 23 // Grabs a file descriptor to /proc.
28 void Warmup(); 24 void Warmup();
29 25
30 // Puts the user in a new PID namespace. 26 // Puts the user in a new PID namespace.
31 void EngageNamespaceSandbox(); 27 void EngageNamespaceSandbox();
32 28
33 // Starts a broker process and sets up seccomp-bpf to delegate decisions to 29 // Starts a broker process and sets up seccomp-bpf to delegate decisions to
34 // it. 30 // it.
35 void EngageSeccompSandbox(); 31 void EngageSeccompSandbox();
36 32
37 // Performs the dropping of access to the outside world (drops the reference 33 // Performs the dropping of access to the outside world (drops the reference
38 // to /proc acquired in Warmup(). 34 // to /proc acquired in Warmup().
39 void Seal(); 35 void Seal();
40 36
41 private: 37 private:
42 bool warmed_up_; 38 bool warmed_up_;
43 base::ScopedFD proc_fd_; 39 base::ScopedFD proc_fd_;
44 scoped_ptr<sandbox::syscall_broker::BrokerProcess> broker_; 40 scoped_ptr<sandbox::syscall_broker::BrokerProcess> broker_;
45 scoped_ptr<sandbox::bpf_dsl::Policy> policy_; 41 scoped_ptr<sandbox::bpf_dsl::Policy> policy_;
46 42
47 DISALLOW_COPY_AND_ASSIGN(LinuxSandbox); 43 DISALLOW_COPY_AND_ASSIGN(LinuxSandbox);
48 }; 44 };
49 45
50 } // namespace mandoline 46 } // namespace mandoline
51 47
52 #endif // MANDOLINE_APP_DESKTOP_LINUX_SANDBOX_H_ 48 #endif // MANDOLINE_APP_DESKTOP_LINUX_SANDBOX_H_
OLDNEW
« no previous file with comments | « no previous file | mandoline/app/desktop/linux_sandbox.cc » ('j') | mandoline/app/desktop/main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698