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

Side by Side Diff: sandbox/linux/syscall_broker/broker_process.cc

Issue 721553002: sandbox: Extend BrokerPolicy to support file creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fix Created 6 years, 1 month 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
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 #include "sandbox/linux/syscall_broker/broker_process.h" 5 #include "sandbox/linux/syscall_broker/broker_process.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 10 matching lines...) Expand all
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
23 #include "base/posix/eintr_wrapper.h" 23 #include "base/posix/eintr_wrapper.h"
24 #include "base/process/process_metrics.h" 24 #include "base/process/process_metrics.h"
25 #include "build/build_config.h" 25 #include "build/build_config.h"
26 #include "sandbox/linux/syscall_broker/broker_client.h" 26 #include "sandbox/linux/syscall_broker/broker_client.h"
27 #include "sandbox/linux/syscall_broker/broker_host.h" 27 #include "sandbox/linux/syscall_broker/broker_host.h"
28 28
29 namespace sandbox { 29 namespace sandbox {
30 30
31 BrokerProcess::BrokerProcess(int denied_errno, 31 BrokerProcess::BrokerProcess(
32 const std::vector<std::string>& allowed_r_files, 32 int denied_errno,
33 const std::vector<std::string>& allowed_w_files, 33 const std::vector<syscall_broker::BrokerPermission>& permissions,
34 bool fast_check_in_client, 34 bool fast_check_in_client,
35 bool quiet_failures_for_tests) 35 bool quiet_failures_for_tests)
36 : initialized_(false), 36 : initialized_(false),
37 is_child_(false), 37 is_child_(false),
38 fast_check_in_client_(fast_check_in_client), 38 fast_check_in_client_(fast_check_in_client),
39 quiet_failures_for_tests_(quiet_failures_for_tests), 39 quiet_failures_for_tests_(quiet_failures_for_tests),
40 broker_pid_(-1), 40 broker_pid_(-1),
41 policy_(denied_errno, allowed_r_files, allowed_w_files), 41 policy_(denied_errno, permissions),
42 ipc_socketpair_(-1) { 42 ipc_socketpair_(-1) {
43 } 43 }
44 44
45 BrokerProcess::~BrokerProcess() { 45 BrokerProcess::~BrokerProcess() {
46 if (initialized_ && ipc_socketpair_ != -1) { 46 if (initialized_ && ipc_socketpair_ != -1) {
47 // Closing the socket should be enough to notify the child to die, 47 // Closing the socket should be enough to notify the child to die,
48 // unless it has been duplicated. 48 // unless it has been duplicated.
49 PCHECK(0 == IGNORE_EINTR(close(ipc_socketpair_))); 49 PCHECK(0 == IGNORE_EINTR(close(ipc_socketpair_)));
50 PCHECK(0 == kill(broker_pid_, SIGKILL)); 50 PCHECK(0 == kill(broker_pid_, SIGKILL));
51 siginfo_t process_info; 51 siginfo_t process_info;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 RAW_CHECK(initialized_); 115 RAW_CHECK(initialized_);
116 return broker_client_->Access(pathname, mode); 116 return broker_client_->Access(pathname, mode);
117 } 117 }
118 118
119 int BrokerProcess::Open(const char* pathname, int flags) const { 119 int BrokerProcess::Open(const char* pathname, int flags) const {
120 RAW_CHECK(initialized_); 120 RAW_CHECK(initialized_);
121 return broker_client_->Open(pathname, flags); 121 return broker_client_->Open(pathname, flags);
122 } 122 }
123 123
124 } // namespace sandbox. 124 } // namespace sandbox.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698