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

Side by Side Diff: sandbox/linux/services/broker_process.h

Issue 226083005: Linux sandbox: componentize almost everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update dependencies. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/linux/seccomp-bpf-helpers/syscall_sets.h ('k') | sandbox/linux/services/credentials.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 SANDBOX_LINUX_SERVICES_BROKER_PROCESS_H_ 5 #ifndef SANDBOX_LINUX_SERVICES_BROKER_PROCESS_H_
6 #define SANDBOX_LINUX_SERVICES_BROKER_PROCESS_H_ 6 #define SANDBOX_LINUX_SERVICES_BROKER_PROCESS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/pickle.h" 13 #include "base/pickle.h"
14 #include "base/process/process.h" 14 #include "base/process/process.h"
15 #include "sandbox/linux/sandbox_export.h"
15 16
16 namespace sandbox { 17 namespace sandbox {
17 18
18 // Create a new "broker" process to which we can send requests via an IPC 19 // Create a new "broker" process to which we can send requests via an IPC
19 // channel. 20 // channel.
20 // This is a low level IPC mechanism that is suitable to be called from a 21 // This is a low level IPC mechanism that is suitable to be called from a
21 // signal handler. 22 // signal handler.
22 // A process would typically create a broker process before entering 23 // A process would typically create a broker process before entering
23 // sandboxing. 24 // sandboxing.
24 // 1. BrokerProcess open_broker(read_whitelist, write_whitelist); 25 // 1. BrokerProcess open_broker(read_whitelist, write_whitelist);
25 // 2. CHECK(open_broker.Init(NULL)); 26 // 2. CHECK(open_broker.Init(NULL));
26 // 3. Enable sandbox. 27 // 3. Enable sandbox.
27 // 4. Use open_broker.Open() to open files. 28 // 4. Use open_broker.Open() to open files.
28 class BrokerProcess { 29 class SANDBOX_EXPORT BrokerProcess {
29 public: 30 public:
30 // |denied_errno| is the error code returned when methods such as Open() 31 // |denied_errno| is the error code returned when methods such as Open()
31 // or Access() are invoked on a file which is not in the whitelist. EACCESS 32 // or Access() are invoked on a file which is not in the whitelist. EACCESS
32 // would be a typical value. 33 // would be a typical value.
33 // |allowed_r_files| and |allowed_w_files| are white lists of files that can 34 // |allowed_r_files| and |allowed_w_files| are white lists of files that can
34 // be opened later via the Open() API, respectively for reading and writing. 35 // be opened later via the Open() API, respectively for reading and writing.
35 // A file available read-write should be listed in both. 36 // A file available read-write should be listed in both.
36 // |fast_check_in_client| and |quiet_failures_for_tests| are reserved for 37 // |fast_check_in_client| and |quiet_failures_for_tests| are reserved for
37 // unit tests, don't use it. 38 // unit tests, don't use it.
38 explicit BrokerProcess(int denied_errno, 39 explicit BrokerProcess(int denied_errno,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 pid_t broker_pid_; // The PID of the broker (child). 95 pid_t broker_pid_; // The PID of the broker (child).
95 const std::vector<std::string> allowed_r_files_; // Files allowed for read. 96 const std::vector<std::string> allowed_r_files_; // Files allowed for read.
96 const std::vector<std::string> allowed_w_files_; // Files allowed for write. 97 const std::vector<std::string> allowed_w_files_; // Files allowed for write.
97 int ipc_socketpair_; // Our communication channel to parent or child. 98 int ipc_socketpair_; // Our communication channel to parent or child.
98 DISALLOW_IMPLICIT_CONSTRUCTORS(BrokerProcess); 99 DISALLOW_IMPLICIT_CONSTRUCTORS(BrokerProcess);
99 }; 100 };
100 101
101 } // namespace sandbox 102 } // namespace sandbox
102 103
103 #endif // SANDBOX_LINUX_SERVICES_BROKER_PROCESS_H_ 104 #endif // SANDBOX_LINUX_SERVICES_BROKER_PROCESS_H_
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp-bpf-helpers/syscall_sets.h ('k') | sandbox/linux/services/credentials.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698