diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-23 03:17:02 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-23 03:17:02 +0000 |
commit | bf84c589154a261c540ba514a0cbf600d77e3c9f (patch) | |
tree | f42157e456d3ad08eda83340ed3545634ede05c0 /ipc | |
parent | 09ba32619bab580cf09824850a3c86b10689894c (diff) | |
download | chromium_src-bf84c589154a261c540ba514a0cbf600d77e3c9f.zip chromium_src-bf84c589154a261c540ba514a0cbf600d77e3c9f.tar.gz chromium_src-bf84c589154a261c540ba514a0cbf600d77e3c9f.tar.bz2 |
This patch caused Chrome to be unable to load any web pages on Chrome OS.
BUG=chromium-os:19468
TEST=confirm chrome loads pages
Revert "Fix IPC OnChannelConnected() to send correct PID on Linux/CrOS"
This reverts commit 92321e01ba42f2d0e9508e921f8b440ac0b5319f.
Review URL: http://codereview.chromium.org/7712022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_channel.h | 13 | ||||
-rw-r--r-- | ipc/ipc_channel_posix.cc | 44 | ||||
-rw-r--r-- | ipc/ipc_channel_posix.h | 8 | ||||
-rw-r--r-- | ipc/ipc_channel_proxy.cc | 39 | ||||
-rw-r--r-- | ipc/ipc_channel_proxy.h | 18 | ||||
-rw-r--r-- | ipc/ipc_sync_channel.cc | 1 | ||||
-rw-r--r-- | ipc/ipc_tests.cc | 3 |
7 files changed, 13 insertions, 113 deletions
diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h index 862c603..cd57b4b 100644 --- a/ipc/ipc_channel.h +++ b/ipc/ipc_channel.h @@ -171,19 +171,6 @@ class IPC_EXPORT Channel : public Message::Sender { void ResetToAcceptingConnectionState(); #endif // defined(OS_POSIX) && !defined(OS_NACL) -#if defined(OS_LINUX) - // Configures the channel to defer OnChannelConnected() until we know the - // global PID of the peer. On Linux, with sandboxed renderers, the browser - // cannot use the process id sent by the renderer in the hello message, - // because the renderer is in its own private PID namespace. With these - // renderers we need to defer our call to OnChannelConnected(peer_pid) until - // we know the global PID. - void SetNeedsOverridePeerPid(); - - // Overrides the peer PID and calls OnChannelConnected() if necessary. - void OverridePeerPid(int32 peer_pid); -#endif // defined(OS_LINUX) - // Returns true if a named server channel is initialized on the given channel // ID. Even if true, the server may have already accepted a connection. static bool IsNamedServerInitialized(const std::string& channel_id); diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc index 27231d1..fe60691 100644 --- a/ipc/ipc_channel_posix.cc +++ b/ipc/ipc_channel_posix.cc @@ -309,9 +309,7 @@ Channel::ChannelImpl::ChannelImpl(const IPC::ChannelHandle& channel_handle, #endif // IPC_USES_READWRITE pipe_name_(channel_handle.name), listener_(listener), - must_unlink_(false), - needs_override_peer_pid_(false), - override_peer_pid_(0) { + must_unlink_(false) { memset(input_buf_, 0, sizeof(input_buf_)); memset(input_cmsg_buf_, 0, sizeof(input_cmsg_buf_)); if (!CreatePipe(channel_handle)) { @@ -729,14 +727,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() { CHECK(descriptor.auto_close); } #endif // IPC_USES_READWRITE - if (needs_override_peer_pid_) { - // If we already have the peer PID, use it. Otherwise we'll call - // OnChannelConnected() in OverridePeerPid() below. - if (override_peer_pid_ != 0) - listener_->OnChannelConnected(override_peer_pid_); - } else { - listener_->OnChannelConnected(pid); - } + listener_->OnChannelConnected(pid); } else { listener_->OnMessageReceived(m); } @@ -1002,27 +993,6 @@ void Channel::ChannelImpl::ResetToAcceptingConnectionState() { input_overflow_fds_.clear(); } -#if defined(OS_LINUX) -void Channel::ChannelImpl::SetNeedsOverridePeerPid() { - needs_override_peer_pid_ = true; -} - -void Channel::ChannelImpl::OverridePeerPid(int32 peer_pid) { - DCHECK(needs_override_peer_pid_); - override_peer_pid_ = peer_pid; - - // The browser learns the global PID of the renderers on the UI thread, and - // must post the data to the IO thread for us to use it here. Therefore - // there is a race between the IPC channel processing the hello message - // and this function being called. If fd_pipe_ != -1 then we've already - // received the hello message and we skipped OnChannelConnected() above, - // so call it here. - if (fd_pipe_ != -1) { - listener_->OnChannelConnected(peer_pid); - } -} -#endif // defined(OS_LINUX) - // static bool Channel::ChannelImpl::IsNamedServerInitialized( const std::string& channel_id) { @@ -1238,16 +1208,6 @@ void Channel::ResetToAcceptingConnectionState() { channel_impl_->ResetToAcceptingConnectionState(); } -#if defined(OS_LINUX) -void Channel::SetNeedsOverridePeerPid() { - channel_impl_->SetNeedsOverridePeerPid(); -} - -void Channel::OverridePeerPid(int32 peer_pid) { - channel_impl_->OverridePeerPid(peer_pid); -} -#endif // defined(OS_LINUX) - // static bool Channel::IsNamedServerInitialized(const std::string& channel_id) { return ChannelImpl::IsNamedServerInitialized(channel_id); diff --git a/ipc/ipc_channel_posix.h b/ipc/ipc_channel_posix.h index c1aaa2b..b66b1fc 100644 --- a/ipc/ipc_channel_posix.h +++ b/ipc/ipc_channel_posix.h @@ -62,10 +62,6 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { bool HasAcceptedConnection() const; bool GetClientEuid(uid_t* client_euid) const; void ResetToAcceptingConnectionState(); -#if defined(OS_LINUX) - void SetNeedsOverridePeerPid(); - void OverridePeerPid(int32 peer_pid); -#endif // defined(OS_LINUX) static bool IsNamedServerInitialized(const std::string& channel_id); private: @@ -151,10 +147,6 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher { // True if we are responsible for unlinking the unix domain socket file. bool must_unlink_; - // See IPC::Channel::SetNeedsOverridePeerPid() header comment for details. - bool needs_override_peer_pid_; - int32 override_peer_pid_; - DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); }; diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index db801fd..dc990c2 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -71,15 +71,10 @@ ChannelProxy::Context::~Context() { } void ChannelProxy::Context::CreateChannel(const IPC::ChannelHandle& handle, - const Channel::Mode& mode, - bool needs_override_peer_pid) { + const Channel::Mode& mode) { DCHECK(channel_.get() == NULL); channel_id_ = handle.name; channel_.reset(new Channel(handle, mode, this)); -#if defined(OS_LINUX) - if (needs_override_peer_pid) - channel_->SetNeedsOverridePeerPid(); -#endif } bool ChannelProxy::Context::TryFilters(const Message& message) { @@ -231,14 +226,6 @@ void ChannelProxy::Context::OnRemoveFilter(MessageFilter* filter) { NOTREACHED() << "filter to be removed not found"; } -#if defined(OS_LINUX) -// Called on the IPC::Channel thread -void ChannelProxy::Context::OnOverridePeerPid(int32 peer_pid) { - if (channel_.get()) - channel_->OverridePeerPid(peer_pid); -} -#endif // defined(OS_LINUX) - // Called on the listener's thread void ChannelProxy::Context::AddFilter(MessageFilter* filter) { base::AutoLock auto_lock(pending_filters_lock_); @@ -295,23 +282,20 @@ void ChannelProxy::Context::OnDispatchError() { ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, Channel::Listener* listener, - base::MessageLoopProxy* ipc_thread, - bool needs_override_peer_pid) + base::MessageLoopProxy* ipc_thread) : context_(new Context(listener, ipc_thread)), outgoing_message_filter_(NULL) { - Init(channel_handle, mode, ipc_thread, true, needs_override_peer_pid); + Init(channel_handle, mode, ipc_thread, true); } ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, base::MessageLoopProxy* ipc_thread, - bool needs_override_peer_pid, Context* context, bool create_pipe_now) : context_(context), outgoing_message_filter_(NULL) { - Init(channel_handle, mode, ipc_thread, create_pipe_now, - needs_override_peer_pid); + Init(channel_handle, mode, ipc_thread, create_pipe_now); } ChannelProxy::~ChannelProxy() { @@ -321,8 +305,7 @@ ChannelProxy::~ChannelProxy() { void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, base::MessageLoopProxy* ipc_thread_loop, - bool create_pipe_now, - bool needs_override_peer_pid) { + bool create_pipe_now) { #if defined(OS_POSIX) // When we are creating a server on POSIX, we need its file descriptor // to be created immediately so that it can be accessed and passed @@ -338,11 +321,10 @@ void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle, // low-level pipe so that the client can connect. Without creating // the pipe immediately, it is possible for a listener to attempt // to connect and get an error since the pipe doesn't exist yet. - context_->CreateChannel(channel_handle, mode, needs_override_peer_pid); + context_->CreateChannel(channel_handle, mode); } else { context_->ipc_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( - context_.get(), &Context::CreateChannel, channel_handle, mode, - needs_override_peer_pid)); + context_.get(), &Context::CreateChannel, channel_handle, mode)); } // complete initialization on the background thread @@ -410,13 +392,6 @@ bool ChannelProxy::GetClientEuid(uid_t* client_euid) const { } #endif -#if defined(OS_LINUX) -void ChannelProxy::OverridePeerPid(int32 peer_pid) { - context_->ipc_message_loop()->PostTask(FROM_HERE, NewRunnableMethod( - context_.get(), &Context::OnOverridePeerPid, peer_pid)); -} -#endif // defined(OS_LINUX) - //----------------------------------------------------------------------------- } // namespace IPC diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index d047b78..792e3d6 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -118,8 +118,7 @@ class IPC_EXPORT ChannelProxy : public Message::Sender { ChannelProxy(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, Channel::Listener* listener, - base::MessageLoopProxy* ipc_thread_loop, - bool needs_override_peer_pid); + base::MessageLoopProxy* ipc_thread_loop); virtual ~ChannelProxy(); @@ -162,11 +161,6 @@ class IPC_EXPORT ChannelProxy : public Message::Sender { bool GetClientEuid(uid_t* client_euid) const; #endif // defined(OS_POSIX) -#if defined(OS_LINUX) - // Calls through to the underlying channel's method. - void OverridePeerPid(int32 peer_pid); -#endif // defined(OS_LINUX) - protected: class Context; // A subclass uses this constructor if it needs to add more information @@ -175,7 +169,6 @@ class IPC_EXPORT ChannelProxy : public Message::Sender { ChannelProxy(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, base::MessageLoopProxy* ipc_thread_loop, - bool needs_override_peer_pid, Context* context, bool create_pipe_now); @@ -224,16 +217,12 @@ class IPC_EXPORT ChannelProxy : public Message::Sender { // Create the Channel void CreateChannel(const IPC::ChannelHandle& channel_handle, - const Channel::Mode& mode, - bool needs_override_peer_pid); + const Channel::Mode& mode); // Methods called on the IO thread. void OnSendMessage(Message* message_ptr); void OnAddFilter(); void OnRemoveFilter(MessageFilter* filter); -#if defined(OS_LINUX) - void OnOverridePeerPid(int32 peer_pid); -#endif // Methods called on the listener thread. void AddFilter(MessageFilter* filter); @@ -268,8 +257,7 @@ class IPC_EXPORT ChannelProxy : public Message::Sender { friend class SendTask; void Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, - base::MessageLoopProxy* ipc_thread_loop, bool create_pipe_now, - bool needs_override_peer_pid); + base::MessageLoopProxy* ipc_thread_loop, bool create_pipe_now); // By maintaining this indirection (ref-counted) to our internal state, we // can safely be destroyed while the background thread continues to do stuff diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index 9cb6454..c135ef3 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -377,7 +377,6 @@ SyncChannel::SyncChannel( WaitableEvent* shutdown_event) : ChannelProxy( channel_handle, mode, ipc_message_loop, - false /* needs_override_peer_pid */, new SyncContext(listener, ipc_message_loop, shutdown_event), create_pipe_now), sync_messages_with_no_timeout_allowed_(true) { diff --git a/ipc/ipc_tests.cc b/ipc/ipc_tests.cc index 7e808a7..2727681 100644 --- a/ipc/ipc_tests.cc +++ b/ipc/ipc_tests.cc @@ -251,8 +251,7 @@ TEST_F(IPCChannelTest, ChannelProxyTest) { { // setup IPC channel proxy IPC::ChannelProxy chan(kTestClientChannel, IPC::Channel::MODE_SERVER, - &channel_listener, thread.message_loop_proxy(), - false /* needs_override_peer_pid */); + &channel_listener, thread.message_loop_proxy()); channel_listener.Init(&chan); |