summaryrefslogtreecommitdiffstats
path: root/components/nacl/common
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-20 20:43:09 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-20 20:44:12 +0000
commitc2fa29f5bca0bc8398e4a5c162a44db84f4f6b5a (patch)
tree8b2948867d5ce35d75398ea94242d1c6ed079ab0 /components/nacl/common
parent26dae5835ebed7c8ee0864d44e25b5abcddbae23 (diff)
downloadchromium_src-c2fa29f5bca0bc8398e4a5c162a44db84f4f6b5a.zip
chromium_src-c2fa29f5bca0bc8398e4a5c162a44db84f4f6b5a.tar.gz
chromium_src-c2fa29f5bca0bc8398e4a5c162a44db84f4f6b5a.tar.bz2
NaCl: Send fatal log messages via shared memory.
nacl_helper reports the last few log messages to the renderer when a LOG_FATAL message is logged in the plugin. This currently uses the "bootstrap" channel, which we would like to get rid of. This uses a shared memory segment instead of IPC, since something bad may have happened in the plugin process, so we'd like to keep the behavior for handling that case as simple as possible. For that reason, the shared memory segment is mapped before the nexe is loaded. I've tested this locally by calling RemoteLog(LOG_FATAL, ...) after StartModule in ServiceRuntime, though I'd like to find some better way to test this as there's a decent amount of logic here. BUG=391039 R=jschuh@chromium.org, mseaborn@chromium.org Review URL: https://codereview.chromium.org/469423002 Cr-Commit-Position: refs/heads/master@{#290910} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/nacl/common')
-rw-r--r--components/nacl/common/nacl_host_messages.h1
-rw-r--r--components/nacl/common/nacl_messages.h1
-rw-r--r--components/nacl/common/nacl_types.cc12
-rw-r--r--components/nacl/common/nacl_types.h14
4 files changed, 23 insertions, 5 deletions
diff --git a/components/nacl/common/nacl_host_messages.h b/components/nacl/common/nacl_host_messages.h
index 0722d9d..f60f4c7 100644
--- a/components/nacl/common/nacl_host_messages.h
+++ b/components/nacl/common/nacl_host_messages.h
@@ -40,6 +40,7 @@ IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchResult)
IPC_STRUCT_TRAITS_MEMBER(manifest_service_ipc_channel_handle)
IPC_STRUCT_TRAITS_MEMBER(plugin_pid)
IPC_STRUCT_TRAITS_MEMBER(plugin_child_id)
+ IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle)
IPC_STRUCT_TRAITS_END()
IPC_STRUCT_TRAITS_BEGIN(nacl::PnaclCacheInfo)
diff --git a/components/nacl/common/nacl_messages.h b/components/nacl/common/nacl_messages.h
index 6d613b0..eeaedf9 100644
--- a/components/nacl/common/nacl_messages.h
+++ b/components/nacl/common/nacl_messages.h
@@ -27,6 +27,7 @@ IPC_STRUCT_TRAITS_BEGIN(nacl::NaClStartParams)
IPC_STRUCT_TRAITS_MEMBER(enable_ipc_proxy)
IPC_STRUCT_TRAITS_MEMBER(uses_irt)
IPC_STRUCT_TRAITS_MEMBER(enable_dyncode_syscalls)
+ IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle)
IPC_STRUCT_TRAITS_END()
//-----------------------------------------------------------------------------
diff --git a/components/nacl/common/nacl_types.cc b/components/nacl/common/nacl_types.cc
index f2c5951..cd115cb 100644
--- a/components/nacl/common/nacl_types.cc
+++ b/components/nacl/common/nacl_types.cc
@@ -16,7 +16,8 @@ NaClStartParams::NaClStartParams()
enable_debug_stub(false),
enable_ipc_proxy(false),
uses_irt(false),
- enable_dyncode_syscalls(false) {
+ enable_dyncode_syscalls(false),
+ crash_info_shmem_handle(base::SharedMemory::NULLHandle()) {
}
NaClStartParams::~NaClStartParams() {
@@ -67,7 +68,8 @@ NaClLaunchResult::NaClLaunchResult()
ppapi_ipc_channel_handle(),
trusted_ipc_channel_handle(),
plugin_pid(base::kNullProcessId),
- plugin_child_id(0) {
+ plugin_child_id(0),
+ crash_info_shmem_handle(base::SharedMemory::NULLHandle()) {
}
NaClLaunchResult::NaClLaunchResult(
@@ -76,13 +78,15 @@ NaClLaunchResult::NaClLaunchResult(
const IPC::ChannelHandle& trusted_ipc_channel_handle,
const IPC::ChannelHandle& manifest_service_ipc_channel_handle,
base::ProcessId plugin_pid,
- int plugin_child_id)
+ int plugin_child_id,
+ base::SharedMemoryHandle crash_info_shmem_handle)
: imc_channel_handle(imc_channel_handle),
ppapi_ipc_channel_handle(ppapi_ipc_channel_handle),
trusted_ipc_channel_handle(trusted_ipc_channel_handle),
manifest_service_ipc_channel_handle(manifest_service_ipc_channel_handle),
plugin_pid(plugin_pid),
- plugin_child_id(plugin_child_id) {
+ plugin_child_id(plugin_child_id),
+ crash_info_shmem_handle(crash_info_shmem_handle) {
}
NaClLaunchResult::~NaClLaunchResult() {
diff --git a/components/nacl/common/nacl_types.h b/components/nacl/common/nacl_types.h
index 6aea090..7ce6b3f 100644
--- a/components/nacl/common/nacl_types.h
+++ b/components/nacl/common/nacl_types.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/memory/shared_memory.h"
#include "base/process/process_handle.h"
#include "build/build_config.h"
#include "ipc/ipc_channel.h"
@@ -37,6 +38,10 @@ inline int ToNativeHandle(const FileDescriptor& desc) {
}
#endif
+// We allocate a page of shared memory for sharing crash information from
+// trusted code in the NaCl process to the renderer.
+static const int kNaClCrashInfoShmemSize = 4096;
+static const int kNaClCrashInfoMaxLogSize = 1024;
// Parameters sent to the NaCl process when we start it.
struct NaClStartParams {
@@ -63,6 +68,9 @@ struct NaClStartParams {
bool uses_irt;
bool enable_dyncode_syscalls;
+ // For NaCl <-> renderer crash information reporting.
+ base::SharedMemoryHandle crash_info_shmem_handle;
+
// NOTE: Any new fields added here must also be added to the IPC
// serialization in nacl_messages.h and (for POD fields) the constructor
// in nacl_types.cc.
@@ -112,7 +120,8 @@ struct NaClLaunchResult {
const IPC::ChannelHandle& trusted_ipc_channel_handle,
const IPC::ChannelHandle& manifest_service_ipc_channel_handle,
base::ProcessId plugin_pid,
- int plugin_child_id);
+ int plugin_child_id,
+ base::SharedMemoryHandle crash_info_shmem_handle);
~NaClLaunchResult();
// For plugin loader <-> renderer IMC communication.
@@ -130,6 +139,9 @@ struct NaClLaunchResult {
base::ProcessId plugin_pid;
int plugin_child_id;
+
+ // For NaCl <-> renderer crash information reporting.
+ base::SharedMemoryHandle crash_info_shmem_handle;
};
} // namespace nacl