summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 20:31:10 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 20:31:10 +0000
commit9f816f720d145872fa7ad141bfe63ea090f3840f (patch)
treefe886c69e458cab0549e4596ad18bf0d53d40747 /ipc
parent642961926500acbcc3ada6f3a5f2dc1454c1a5a8 (diff)
downloadchromium_src-9f816f720d145872fa7ad141bfe63ea090f3840f.zip
chromium_src-9f816f720d145872fa7ad141bfe63ea090f3840f.tar.gz
chromium_src-9f816f720d145872fa7ad141bfe63ea090f3840f.tar.bz2
The plugin channel host in the renderer process should not initialize IPC
using a known-closed channel name. Instead, when the channel name is known to be closed, initialization should fail. On POSIX systems, the channel is created by the plugin channel in the plugin process and shared with the renderer process over IPC. If the channel closes, the renderer process must not attempt to reestablish it; the plugin process must do that. This serves as early detection for and an escape from the assertion that causes renderers to die and be replaced by a sad tab when attempting to open multiple pages with plugins simultaneously. This resolves the Mac renderer top crash. BUG=26754 TEST=Test case from bug 26754 comment 9 (affected Macs only): a. Have lots of bookmarks (import Safari defaults) b. Right-click on bookmark bar, and choose "Open All Bookmarks" Expect: no crash, no sad tabs. This test should be repeated many times. Review URL: http://codereview.chromium.org/984004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_channel_posix.cc8
-rw-r--r--ipc/ipc_channel_posix.h3
2 files changed, 10 insertions, 1 deletions
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 545ad0c..f6b19f7 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -299,6 +299,11 @@ void RemoveAndCloseChannelSocket(const std::string& name) {
}
// static
+bool ChannelSocketExists(const std::string& name) {
+ return Singleton<PipeMap>()->Lookup(name) != -1;
+}
+
+// static
bool SocketPair(int* fd1, int* fd2) {
int pipe_fds[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe_fds) != 0) {
@@ -362,7 +367,8 @@ bool Channel::ChannelImpl::CreatePipe(const std::string& channel_id,
// initial channel must not be recycled here. http://crbug.com/26754.
static bool used_initial_channel = false;
if (used_initial_channel) {
- LOG(FATAL) << "Denying attempt to reuse initial IPC channel";
+ LOG(FATAL) << "Denying attempt to reuse initial IPC channel for "
+ << pipe_name_;
return false;
}
used_initial_channel = true;
diff --git a/ipc/ipc_channel_posix.h b/ipc/ipc_channel_posix.h
index 714b150..dd45345 100644
--- a/ipc/ipc_channel_posix.h
+++ b/ipc/ipc_channel_posix.h
@@ -26,6 +26,9 @@ void AddChannelSocket(const std::string& name, int socket);
// Remove the channel name mapping, and close the corresponding socket.
void RemoveAndCloseChannelSocket(const std::string& name);
+// Returns true if a channel named |name| is available.
+bool ChannelSocketExists(const std::string& name);
+
// Construct a socket pair appropriate for IPC: UNIX domain, nonblocking.
// Returns false on error.
bool SocketPair(int* fd1, int* fd2);