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

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, 1 month 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
« components/nacl/loader/nacl_helper_linux.cc ('K') | « ipc/ipc_channel_posix.h ('k') | no next file » | 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 79fc7f203a6cba777a7305dabf838109f8653f83..fa91e520bfcfde698fc248c8f16a9c38e6fd9ca2 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -176,9 +176,9 @@ void Channel::NotifyProcessForkedForTesting() {
//------------------------------------------------------------------------------
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_NACL_NONSFI)
int ChannelPosix::global_pid_ = 0;
-#endif // OS_LINUX
+#endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI)
ChannelPosix::ChannelPosix(const IPC::ChannelHandle& channel_handle,
Mode mode, Listener* listener)
@@ -645,12 +645,12 @@ bool ChannelPosix::IsNamedServerInitialized(
return base::PathExists(base::FilePath(channel_id));
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_NACL_NONSFI)
// static
void ChannelPosix::SetGlobalPid(int pid) {
global_pid_ = pid;
}
-#endif // OS_LINUX
+#endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI)
// Called by libevent when we can read from the pipe without blocking.
void ChannelPosix::OnFileCanReadWithoutBlocking(int fd) {
@@ -771,14 +771,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)
+ // Our process may be in a sandbox with a separate PID namespace in Linux.
+ // In nacl_helper_nonsfi, getpid() invoked by GetCurrentProcId() is not
+ // allowed and would cause a SIGSYS crashing because of the seccomp sandbox.
+ // |global_pid_| should be initialized in advance in the process.
+ if (global_pid_)
+ return global_pid_;
mdempsky 2014/11/07 03:05:34 Will global_pid_ ever be set to anything other tha
hidehiko 2014/11/07 05:43:21 This is both for SFI (under OS_LINUX) and Non-SFI
Mark Seaborn 2014/12/03 01:54:00 I agree with Matthew's comment about doing: #if de
hidehiko 2014/12/03 17:03:19 Ok, done, in mdempsky@'s way. My focus is Non-SFI.
#endif
- return pid;
+ return base::GetCurrentProcId();
}
void ChannelPosix::QueueHelloMessage() {
@@ -1111,11 +1112,11 @@ bool Channel::IsNamedServerInitialized(
return ChannelPosix::IsNamedServerInitialized(channel_id);
}
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_NACL_NONSFI)
// static
void Channel::SetGlobalPid(int pid) {
ChannelPosix::SetGlobalPid(pid);
}
-#endif // OS_LINUX
+#endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI)
} // namespace IPC
« components/nacl/loader/nacl_helper_linux.cc ('K') | « ipc/ipc_channel_posix.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698