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

Unified Diff: content/zygote/zygote_main_linux.cc

Issue 258893004: Use RecvMsgWithPid to find zygote PID instead of chrome-sandbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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
Index: content/zygote/zygote_main_linux.cc
diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
index 0ec9b438366fc69442e5e42bdeead4c70e01ee25..360cc7a46955810d62e754f9958ca1a46a5ea7da 100644
--- a/content/zygote/zygote_main_linux.cc
+++ b/content/zygote/zygote_main_linux.cc
@@ -23,6 +23,7 @@
#include "base/linux_util.h"
#include "base/native_library.h"
#include "base/pickle.h"
+#include "base/posix/eintr_wrapper.h"
#include "base/posix/unix_domain_socket_linux.h"
#include "base/rand_util.h"
#include "base/sys_info.h"
@@ -344,19 +345,10 @@ static void ZygotePreSandboxInit() {
new FontConfigIPC(GetSandboxFD()))->unref();
}
-static void CloseFdAndHandleEintr(int fd) {
- close(fd);
-}
-
static bool CreateInitProcessReaper() {
- // This "magic" socket must only appear in one process, so make sure
- // it gets closed in the parent after fork().
- base::Closure zygoteid_fd_closer =
- base::Bind(CloseFdAndHandleEintr, kZygoteIdFd);
// The current process becomes init(1), this function returns from a
// newly created process.
- const bool init_created =
- sandbox::CreateInitProcessReaper(&zygoteid_fd_closer);
+ const bool init_created = sandbox::CreateInitProcessReaper(NULL);
if (!init_created) {
LOG(ERROR) << "Error creating an init process to reap zombies";
return false;
@@ -460,6 +452,10 @@ bool ZygoteMain(const MainFunctionParams& params,
const bool must_enable_setuid_sandbox =
linux_sandbox->setuid_sandbox_client()->IsSuidSandboxChild();
+ if (must_enable_setuid_sandbox) {
+ // We have no use for the zygote ID descriptor anymore.
jln (very slow on Chromium) 2014/04/26 00:54:10 Maybe be more explicit? "kZygoteIdFd has been pass
mdempsky 2014/04/26 06:05:58 Done.
+ CHECK_EQ(0, IGNORE_EINTR(close(kZygoteIdFd)));
+ }
if (forkdelegate != NULL) {
VLOG(1) << "ZygoteMain: initializing fork delegate";
« content/browser/zygote_host/zygote_host_impl_linux.cc ('K') | « content/zygote/zygote_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698