From 140735acbef15c56d9ddaadd2bc58b5e26692a48 Mon Sep 17 00:00:00 2001 From: erg Date: Thu, 12 Nov 2015 10:51:56 -0800 Subject: mandoline: Reland "Fix ICU initialization". We need to complete the initialization of ICU before we raise the sandbox. That means we can't pass a file descriptor to the ICU data file across mojo pipes. Due to how Android handles resources files, we also can't pass a file descriptor around inside the same process. So pass a raw pointer to a memory mapped file during the sandbox warm-up phase, and make a new option to initialize ICU from this raw pointer. But that just uncovers a bigger issue: we don't always call what was the sandbox warming code. If it's general initialization that needs to be called before we run MojoMain(), we need to include initialization code in most all main.cc implementations. This bakes a base initialize call into the mojo application library. This fixes a crash in the page cycler set, which happens when a page tries to do date operations, which fail because of missing locale data. This fixes several crashes in local runs. [[This reland disables the sandbox on the page cycler bots because they don't have a new enough kernel to be sandboxed(!). It also includes the icu data in the mojo runner unittests.]] BUG=546644 First Review URL: https://codereview.chromium.org/1425853003 TBR=jam@chromium.org,sky@chromium.org R=yzshen@chromium.org Review URL: https://codereview.chromium.org/1431133003 Cr-Commit-Position: refs/heads/master@{#359349} --- mandoline/app/desktop/launcher_process.cc | 2 -- mandoline/services/core_services/BUILD.gn | 5 ----- mandoline/services/core_services/main.cc | 26 -------------------------- 3 files changed, 33 deletions(-) (limited to 'mandoline') diff --git a/mandoline/app/desktop/launcher_process.cc b/mandoline/app/desktop/launcher_process.cc index 5a94a32..60f5e32 100644 --- a/mandoline/app/desktop/launcher_process.cc +++ b/mandoline/app/desktop/launcher_process.cc @@ -32,8 +32,6 @@ int LauncherProcessMain(int argc, char** argv) { if (!command_line->HasSwitch(switches::kMojoSingleProcess)) command_line->AppendSwitch(switches::kEnableMultiprocess); command_line->AppendSwitch("use-new-edk"); - // http://crbug.com/546644 - command_line->AppendSwitch(switches::kMojoNoSandbox); bool trace_startup = command_line->HasSwitch(switches::kTraceStartup); if (trace_startup) { diff --git a/mandoline/services/core_services/BUILD.gn b/mandoline/services/core_services/BUILD.gn index f3b6ed7..8e093f8 100644 --- a/mandoline/services/core_services/BUILD.gn +++ b/mandoline/services/core_services/BUILD.gn @@ -27,11 +27,6 @@ mojo_native_application("core_services") { } deps += [ ":copy_files" ] } - - if (!is_android) { - deps += [ "//third_party/icu:icudata" ] - resources = [ "$root_out_dir/icudtl.dat" ] - } } source_set("sources") { diff --git a/mandoline/services/core_services/main.cc b/mandoline/services/core_services/main.cc index e9d36ba..ef8c847 100644 --- a/mandoline/services/core_services/main.cc +++ b/mandoline/services/core_services/main.cc @@ -6,32 +6,6 @@ #include "mojo/application/public/cpp/application_runner.h" #include "third_party/mojo/src/mojo/public/c/system/main.h" -// TODO(erg): Much of this will be the same between mojo applications. Maybe we -// could centralize this code? -#if defined(OS_LINUX) && !defined(OS_ANDROID) -#include "base/rand_util.h" -#include "base/sys_info.h" -#include "third_party/icu/source/i18n/unicode/timezone.h" - -// TODO(erg): Much of this was coppied from zygote_main_linux.cc -extern "C" { -void __attribute__((visibility("default"))) MojoSandboxWarm() { - base::RandUint64(); - base::SysInfo::AmountOfPhysicalMemory(); - base::SysInfo::MaxSharedMemorySize(); - base::SysInfo::NumberOfProcessors(); - - // ICU DateFormat class (used in base/time_format.cc) needs to get the - // Olson timezone ID by accessing the zoneinfo files on disk. After - // TimeZone::createDefault is called once here, the timezone ID is - // cached and there's no more need to access the file system. - scoped_ptr zone(icu::TimeZone::createDefault()); - - // TODO(erg): Perform OpenSSL warmup; it wants access to /dev/urandom. -} -} -#endif // defined(OS_LINUX) && !defined(OS_ANDROID) - MojoResult MojoMain(MojoHandle shell_handle) { mojo::ApplicationRunner runner( new core_services::CoreServicesApplicationDelegate); -- cgit v1.1