Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: ipc/ipc_channel_posix.cc

Issue 695353005: Non-SFI mode: Use dummy PID for NaCl's IPC channel on Linux platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_channel_posix.h ('k') | ipc/ipc_sync_channel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ipc/ipc_channel_posix.h ('k') | ipc/ipc_sync_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698