summaryrefslogtreecommitdiff
path: root/chromium/content/zygote
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/zygote')
-rw-r--r--chromium/content/zygote/zygote_browsertest.cc27
-rw-r--r--chromium/content/zygote/zygote_linux.cc3
-rw-r--r--chromium/content/zygote/zygote_linux.h7
-rw-r--r--chromium/content/zygote/zygote_main_linux.cc13
4 files changed, 41 insertions, 9 deletions
diff --git a/chromium/content/zygote/zygote_browsertest.cc b/chromium/content/zygote/zygote_browsertest.cc
index 4122bb792bd..5376445fba5 100644
--- a/chromium/content/zygote/zygote_browsertest.cc
+++ b/chromium/content/zygote/zygote_browsertest.cc
@@ -5,7 +5,9 @@
#include <string>
#include <vector>
+#include "base/command_line.h"
#include "base/strings/string_split.h"
+#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
@@ -38,4 +40,29 @@ IN_PROC_BROWSER_TEST_F(LinuxZygoteBrowserTest, GetLocalTimeHasTimeZone) {
EXPECT_TRUE(parts[2].empty());
}
+class LinuxZygoteDisabledBrowserTest : public ContentBrowserTest {
+ public:
+ LinuxZygoteDisabledBrowserTest() {}
+ ~LinuxZygoteDisabledBrowserTest() override {}
+
+ protected:
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ ContentBrowserTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitch(switches::kNoZygote);
+ command_line->AppendSwitch(switches::kNoSandbox);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LinuxZygoteDisabledBrowserTest);
+};
+
+// https://crbug.com/712779
+#if !defined(THREAD_SANITIZER)
+// Test that the renderer doesn't crash during launch if zygote is disabled.
+IN_PROC_BROWSER_TEST_F(LinuxZygoteDisabledBrowserTest,
+ NoCrashWhenZygoteDisabled) {
+ NavigateToURL(shell(), GURL("data:text/html,start page"));
+}
+#endif
+
} // namespace content
diff --git a/chromium/content/zygote/zygote_linux.cc b/chromium/content/zygote/zygote_linux.cc
index 3fdcd8f4498..1fe8ed728e3 100644
--- a/chromium/content/zygote/zygote_linux.cc
+++ b/chromium/content/zygote/zygote_linux.cc
@@ -125,7 +125,8 @@ bool Zygote::ProcessRequests() {
if (UsingSUIDSandbox() || UsingNSSandbox()) {
// Let the ZygoteHost know we are ready to go.
- // The receiving code is in content/browser/zygote_host_linux.cc.
+ // The receiving code is in
+ // content/browser/zygote_host/zygote_host_impl_linux.cc.
bool r = base::UnixDomainSocket::SendMsg(kZygoteSocketPairFd,
kZygoteHelloMessage,
sizeof(kZygoteHelloMessage),
diff --git a/chromium/content/zygote/zygote_linux.h b/chromium/content/zygote/zygote_linux.h
index 79a06eb220c..3eb7a1562fb 100644
--- a/chromium/content/zygote/zygote_linux.h
+++ b/chromium/content/zygote/zygote_linux.h
@@ -51,14 +51,13 @@ class Zygote {
// Notes whether the zygote has sent SIGKILL to this process.
bool sent_sigkill;
};
- typedef base::SmallMap< std::map<base::ProcessHandle, ZygoteProcessInfo> >
- ZygoteProcessMap;
+ using ZygoteProcessMap =
+ base::small_map<std::map<base::ProcessHandle, ZygoteProcessInfo>>;
// Retrieve a ZygoteProcessInfo from the process_info_map_.
// Returns true and write to process_info if |pid| can be found, return
// false otherwise.
- bool GetProcessInfo(base::ProcessHandle pid,
- ZygoteProcessInfo* process_info);
+ bool GetProcessInfo(base::ProcessHandle pid, ZygoteProcessInfo* process_info);
// Returns true if the SUID sandbox is active.
bool UsingSUIDSandbox() const;
diff --git a/chromium/content/zygote/zygote_main_linux.cc b/chromium/content/zygote/zygote_main_linux.cc
index b6f7089e35c..78636ee0407 100644
--- a/chromium/content/zygote/zygote_main_linux.cc
+++ b/chromium/content/zygote/zygote_main_linux.cc
@@ -617,10 +617,15 @@ bool ZygoteMain(
if (using_layer1_sandbox) {
// Let the ZygoteHost know we're booting up.
- CHECK(base::UnixDomainSocket::SendMsg(kZygoteSocketPairFd,
- kZygoteBootMessage,
- sizeof(kZygoteBootMessage),
- std::vector<int>()));
+ if (!base::UnixDomainSocket::SendMsg(
+ kZygoteSocketPairFd, kZygoteBootMessage, sizeof(kZygoteBootMessage),
+ std::vector<int>())) {
+ // This is not a CHECK failure because the browser process could either
+ // crash or quickly exit while the zygote is starting. In either case a
+ // zygote crash is not useful. http://crbug.com/692227
+ PLOG(ERROR) << "Failed sending zygote boot message";
+ _exit(1);
+ }
}
VLOG(1) << "ZygoteMain: initializing " << fork_delegates.size()