summaryrefslogtreecommitdiff
path: root/chromium/sandbox/mac
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-25 11:39:07 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-01-25 15:20:42 +0000
commit6c91641271e536ffaa88a1dff5127e42ee99a91e (patch)
tree703d9dd49602377ddc90cbf886aad37913f2496b /chromium/sandbox/mac
parentb145b7fafd36f0c260d6a768c81fc14e32578099 (diff)
downloadqtwebengine-chromium-6c91641271e536ffaa88a1dff5127e42ee99a91e.tar.gz
BASELINE: Update Chromium to 49.0.2623.23
Also adds missing printing sources. Change-Id: I3726b8f0c7d6751c9fc846096c571fadca7108cd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/sandbox/mac')
-rw-r--r--chromium/sandbox/mac/bootstrap_sandbox.cc8
-rw-r--r--chromium/sandbox/mac/bootstrap_sandbox.h3
-rw-r--r--chromium/sandbox/mac/launchd_interception_server.cc9
-rw-r--r--chromium/sandbox/mac/mach_message_server.cc5
-rw-r--r--chromium/sandbox/mac/mach_message_server.h2
-rw-r--r--chromium/sandbox/mac/message_server.h5
-rw-r--r--chromium/sandbox/mac/os_compatibility.cc2
-rw-r--r--chromium/sandbox/mac/os_compatibility.h1
-rw-r--r--chromium/sandbox/mac/pre_exec_delegate.cc1
-rw-r--r--chromium/sandbox/mac/pre_exec_delegate.h3
-rw-r--r--chromium/sandbox/mac/xpc_message_server.cc6
-rw-r--r--chromium/sandbox/mac/xpc_message_server.h2
-rw-r--r--chromium/sandbox/mac/xpc_message_server_unittest.cc1
-rw-r--r--chromium/sandbox/mac/xpc_stubs_header.fragment2
14 files changed, 42 insertions, 8 deletions
diff --git a/chromium/sandbox/mac/bootstrap_sandbox.cc b/chromium/sandbox/mac/bootstrap_sandbox.cc
index e8997f9ef68..dee7903c171 100644
--- a/chromium/sandbox/mac/bootstrap_sandbox.cc
+++ b/chromium/sandbox/mac/bootstrap_sandbox.cc
@@ -5,11 +5,13 @@
#include "sandbox/mac/bootstrap_sandbox.h"
#include <servers/bootstrap.h>
+#include <stdint.h>
#include <unistd.h>
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mach_logging.h"
+#include "base/macros.h"
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "sandbox/mac/launchd_interception_server.h"
@@ -66,7 +68,7 @@ scoped_ptr<BootstrapSandbox> BootstrapSandbox::Create() {
if (kr != KERN_SUCCESS) {
BOOTSTRAP_LOG(ERROR, kr)
<< "Failed to bootstrap_check_in the sandbox server.";
- return null.Pass();
+ return null;
}
sandbox->check_in_port_.reset(port);
@@ -79,9 +81,9 @@ scoped_ptr<BootstrapSandbox> BootstrapSandbox::Create() {
// Start the sandbox server.
if (!sandbox->launchd_server_->Initialize(MACH_PORT_NULL))
- return null.Pass();
+ return null;
- return sandbox.Pass();
+ return sandbox;
}
// Warning: This function must be safe to call in
diff --git a/chromium/sandbox/mac/bootstrap_sandbox.h b/chromium/sandbox/mac/bootstrap_sandbox.h
index fa5f859ed4c..2ae4513c8f6 100644
--- a/chromium/sandbox/mac/bootstrap_sandbox.h
+++ b/chromium/sandbox/mac/bootstrap_sandbox.h
@@ -6,6 +6,7 @@
#define SANDBOX_MAC_BOOTSTRAP_SANDBOX_H_
#include <mach/mach.h>
+#include <stdint.h>
#include <map>
#include <string>
@@ -83,7 +84,7 @@ class SANDBOX_EXPORT BootstrapSandbox {
const BootstrapSandboxPolicy* PolicyForProcess(pid_t pid) const;
std::string server_bootstrap_name() const { return server_bootstrap_name_; }
- mach_port_t real_bootstrap_port() const { return real_bootstrap_port_; }
+ mach_port_t real_bootstrap_port() const { return real_bootstrap_port_.get(); }
private:
BootstrapSandbox();
diff --git a/chromium/sandbox/mac/launchd_interception_server.cc b/chromium/sandbox/mac/launchd_interception_server.cc
index f466e77d4bc..69231b59508 100644
--- a/chromium/sandbox/mac/launchd_interception_server.cc
+++ b/chromium/sandbox/mac/launchd_interception_server.cc
@@ -5,6 +5,8 @@
#include "sandbox/mac/launchd_interception_server.h"
#include <servers/bootstrap.h>
+#include <stddef.h>
+#include <stdint.h>
#include "base/logging.h"
#include "base/mac/mac_util.h"
@@ -30,6 +32,7 @@ LaunchdInterceptionServer::LaunchdInterceptionServer(
}
LaunchdInterceptionServer::~LaunchdInterceptionServer() {
+ message_server_->Shutdown();
}
bool LaunchdInterceptionServer::Initialize(mach_port_t server_receive_right) {
@@ -44,12 +47,12 @@ bool LaunchdInterceptionServer::Initialize(mach_port_t server_receive_right) {
return false;
}
sandbox_port_.reset(port);
- if ((kr = mach_port_insert_right(task, sandbox_port_, sandbox_port_,
- MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS)) {
+ if ((kr = mach_port_insert_right(task, sandbox_port_.get(),
+ sandbox_port_.get(), MACH_MSG_TYPE_MAKE_SEND) != KERN_SUCCESS)) {
MACH_LOG(ERROR, kr) << "Failed to allocate dummy sandbox port send right.";
return false;
}
- sandbox_send_port_.reset(sandbox_port_);
+ sandbox_send_port_.reset(sandbox_port_.get());
if (base::mac::IsOSYosemiteOrLater()) {
message_server_.reset(new XPCMessageServer(this, server_receive_right));
diff --git a/chromium/sandbox/mac/mach_message_server.cc b/chromium/sandbox/mac/mach_message_server.cc
index 7cfcecc6cc2..7626c3af545 100644
--- a/chromium/sandbox/mac/mach_message_server.cc
+++ b/chromium/sandbox/mac/mach_message_server.cc
@@ -6,6 +6,7 @@
#include <bsm/libbsm.h>
#include <servers/bootstrap.h>
+#include <stddef.h>
#include <string>
@@ -75,6 +76,10 @@ bool MachMessageServer::Initialize() {
return true;
}
+void MachMessageServer::Shutdown() {
+ dispatch_source_.reset();
+}
+
pid_t MachMessageServer::GetMessageSenderPID(IPCMessage request) {
// Get the PID of the task that sent this request. This requires getting at
// the trailer of the message, from the header.
diff --git a/chromium/sandbox/mac/mach_message_server.h b/chromium/sandbox/mac/mach_message_server.h
index 20a543b3c7b..515d5655139 100644
--- a/chromium/sandbox/mac/mach_message_server.h
+++ b/chromium/sandbox/mac/mach_message_server.h
@@ -6,6 +6,7 @@
#define SANDBOX_MAC_MACH_MESSAGE_SERVER_H_
#include <mach/mach.h>
+#include <stddef.h>
#include "base/mac/dispatch_source_mach.h"
#include "base/mac/scoped_mach_port.h"
@@ -33,6 +34,7 @@ class MachMessageServer : public MessageServer {
// MessageServer:
bool Initialize() override;
+ void Shutdown() override;
pid_t GetMessageSenderPID(IPCMessage request) override;
IPCMessage CreateReply(IPCMessage request) override;
bool SendReply(IPCMessage reply) override;
diff --git a/chromium/sandbox/mac/message_server.h b/chromium/sandbox/mac/message_server.h
index 1cd40b0a3dc..6ee119bd5e5 100644
--- a/chromium/sandbox/mac/message_server.h
+++ b/chromium/sandbox/mac/message_server.h
@@ -44,6 +44,11 @@ class MessageServer {
// returns false, no other methods may be called on this class.
virtual bool Initialize() = 0;
+ // Blocks the calling thread while the server shuts down. This prevents
+ // the server from receiving new messages. After this method is called,
+ // no other methods may be called on this class.
+ virtual void Shutdown() = 0;
+
// Given a received request message, returns the PID of the sending process.
virtual pid_t GetMessageSenderPID(IPCMessage request) = 0;
diff --git a/chromium/sandbox/mac/os_compatibility.cc b/chromium/sandbox/mac/os_compatibility.cc
index f1ad5286a16..5ddf6a5d03e 100644
--- a/chromium/sandbox/mac/os_compatibility.cc
+++ b/chromium/sandbox/mac/os_compatibility.cc
@@ -5,6 +5,8 @@
#include "sandbox/mac/os_compatibility.h"
#include <servers/bootstrap.h>
+#include <stddef.h>
+#include <stdint.h>
#include <unistd.h>
#include "base/mac/mac_util.h"
diff --git a/chromium/sandbox/mac/os_compatibility.h b/chromium/sandbox/mac/os_compatibility.h
index a1f51f27dc6..4f18c34a590 100644
--- a/chromium/sandbox/mac/os_compatibility.h
+++ b/chromium/sandbox/mac/os_compatibility.h
@@ -13,6 +13,7 @@
#define SANDBOX_MAC_OS_COMPATIBILITY_H_
#include <mach/mach.h>
+#include <stdint.h>
#include <string>
diff --git a/chromium/sandbox/mac/pre_exec_delegate.cc b/chromium/sandbox/mac/pre_exec_delegate.cc
index adf40a0da4c..9d777d3f4d0 100644
--- a/chromium/sandbox/mac/pre_exec_delegate.cc
+++ b/chromium/sandbox/mac/pre_exec_delegate.cc
@@ -6,6 +6,7 @@
#include <mach/mach.h>
#include <servers/bootstrap.h>
+#include <stdint.h>
#include "base/logging.h"
#include "base/mac/mac_util.h"
diff --git a/chromium/sandbox/mac/pre_exec_delegate.h b/chromium/sandbox/mac/pre_exec_delegate.h
index b84082eac0b..4ed41db8981 100644
--- a/chromium/sandbox/mac/pre_exec_delegate.h
+++ b/chromium/sandbox/mac/pre_exec_delegate.h
@@ -5,6 +5,9 @@
#ifndef SANDBOX_MAC_PRE_EXEC_DELEGATE_H_
#define SANDBOX_MAC_PRE_EXEC_DELEGATE_H_
+#include <stdint.h>
+
+#include "base/macros.h"
#include "base/process/launch.h"
#include "sandbox/mac/xpc.h"
diff --git a/chromium/sandbox/mac/xpc_message_server.cc b/chromium/sandbox/mac/xpc_message_server.cc
index e161b5a2d0c..13753101ede 100644
--- a/chromium/sandbox/mac/xpc_message_server.cc
+++ b/chromium/sandbox/mac/xpc_message_server.cc
@@ -48,6 +48,10 @@ bool XPCMessageServer::Initialize() {
return true;
}
+void XPCMessageServer::Shutdown() {
+ dispatch_source_.reset();
+}
+
pid_t XPCMessageServer::GetMessageSenderPID(IPCMessage request) {
audit_token_t token;
xpc_dictionary_get_audit_token(request.xpc, &token);
@@ -104,7 +108,7 @@ mach_port_t XPCMessageServer::GetServerPort() const {
void XPCMessageServer::ReceiveMessage() {
IPCMessage request;
- int rv = xpc_pipe_receive(server_port_, &request.xpc);
+ int rv = xpc_pipe_receive(server_port_.get(), &request.xpc);
if (rv) {
LOG(ERROR) << "Failed to xpc_pipe_receive(): " << rv;
return;
diff --git a/chromium/sandbox/mac/xpc_message_server.h b/chromium/sandbox/mac/xpc_message_server.h
index 48209a60d1a..c509bab0d81 100644
--- a/chromium/sandbox/mac/xpc_message_server.h
+++ b/chromium/sandbox/mac/xpc_message_server.h
@@ -9,6 +9,7 @@
#include "base/mac/dispatch_source_mach.h"
#include "base/mac/scoped_mach_port.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "sandbox/mac/message_server.h"
#include "sandbox/mac/xpc.h"
@@ -30,6 +31,7 @@ class SANDBOX_EXPORT XPCMessageServer : public MessageServer {
// MessageServer:
bool Initialize() override;
+ void Shutdown() override;
pid_t GetMessageSenderPID(IPCMessage request) override;
IPCMessage CreateReply(IPCMessage request) override;
bool SendReply(IPCMessage reply) override;
diff --git a/chromium/sandbox/mac/xpc_message_server_unittest.cc b/chromium/sandbox/mac/xpc_message_server_unittest.cc
index 26e4ad0dcc4..585a627c512 100644
--- a/chromium/sandbox/mac/xpc_message_server_unittest.cc
+++ b/chromium/sandbox/mac/xpc_message_server_unittest.cc
@@ -7,6 +7,7 @@
#include <Block.h>
#include <mach/mach.h>
#include <servers/bootstrap.h>
+#include <stdint.h>
#include "base/command_line.h"
#include "base/logging.h"
diff --git a/chromium/sandbox/mac/xpc_stubs_header.fragment b/chromium/sandbox/mac/xpc_stubs_header.fragment
index 977ffe78504..2aa81ccc9ec 100644
--- a/chromium/sandbox/mac/xpc_stubs_header.fragment
+++ b/chromium/sandbox/mac/xpc_stubs_header.fragment
@@ -6,6 +6,8 @@
#define SANDBOX_MAC_XPC_STUBS_HEADER_FRAGMENT_
#include <bsm/libbsm.h>
+#include <stddef.h>
+#include <stdint.h>
#include "sandbox/sandbox_export.h"