Index: ipc/ipc_channel_posix.cc |
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc |
index 08529932250ad04d0c0a3c9be42049fed7728d02..9d7d50a4ffe7c1e542e041b5609f6a0c6489660b 100644 |
--- a/ipc/ipc_channel_posix.cc |
+++ b/ipc/ipc_channel_posix.cc |
@@ -176,10 +176,6 @@ void Channel::NotifyProcessForkedForTesting() { |
//------------------------------------------------------------------------------ |
-#if defined(OS_LINUX) |
-int ChannelPosix::global_pid_ = 0; |
-#endif // OS_LINUX |
- |
ChannelPosix::ChannelPosix(const IPC::ChannelHandle& channel_handle, |
Mode mode, Listener* listener) |
: ChannelReader(listener), |
@@ -645,13 +641,6 @@ bool ChannelPosix::IsNamedServerInitialized( |
return base::PathExists(base::FilePath(channel_id)); |
} |
-#if defined(OS_LINUX) |
-// static |
-void ChannelPosix::SetGlobalPid(int pid) { |
- global_pid_ = pid; |
-} |
-#endif // OS_LINUX |
- |
// Called by libevent when we can read from the pipe without blocking. |
void ChannelPosix::OnFileCanReadWithoutBlocking(int fd) { |
if (fd == server_listen_pipe_.get()) { |
@@ -771,14 +760,15 @@ void ChannelPosix::ClosePipeOnError() { |
} |
int ChannelPosix::GetHelloMessageProcId() const { |
- int pid = base::GetCurrentProcId(); |
-#if defined(OS_LINUX) |
- // Our process may be in a sandbox with a separate PID namespace. |
- if (global_pid_) { |
- pid = global_pid_; |
- } |
+#if defined(OS_LINUX) || defined(OS_NACL_NONSFI) |
+ // On Linux platform, PID does not play any security role. |
+ // In nacl_helper_nonsfi, getpid() invoked by GetCurrentProcId() is not |
+ // allowed and would cause a SIGSYS crash because of the seccomp sandbox. |
+ // So, for both cases, we provide a dummy PID. |
+ return -1; |
+#else |
+ return base::GetCurrentProcId(); |
#endif |
- return pid; |
} |
void ChannelPosix::QueueHelloMessage() { |
@@ -1107,11 +1097,4 @@ bool Channel::IsNamedServerInitialized( |
return ChannelPosix::IsNamedServerInitialized(channel_id); |
} |
-#if defined(OS_LINUX) |
-// static |
-void Channel::SetGlobalPid(int pid) { |
- ChannelPosix::SetGlobalPid(pid); |
-} |
-#endif // OS_LINUX |
- |
} // namespace IPC |