Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <dlfcn.h> | 5 #include <dlfcn.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <pthread.h> | 7 #include <pthread.h> |
| 8 #include <sys/epoll.h> | 8 #include <sys/epoll.h> |
| 9 #include <sys/prctl.h> | 9 #include <sys/prctl.h> |
| 10 #include <sys/signal.h> | 10 #include <sys/signal.h> |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 594 // ICU DateFormat class (used in base/time_format.cc) needs to get the | 594 // ICU DateFormat class (used in base/time_format.cc) needs to get the |
| 595 // Olson timezone ID by accessing the zoneinfo files on disk. After | 595 // Olson timezone ID by accessing the zoneinfo files on disk. After |
| 596 // TimeZone::createDefault is called once here, the timezone ID is | 596 // TimeZone::createDefault is called once here, the timezone ID is |
| 597 // cached and there's no more need to access the file system. | 597 // cached and there's no more need to access the file system. |
| 598 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); | 598 scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault()); |
| 599 | 599 |
| 600 FilePath module_path; | 600 FilePath module_path; |
| 601 if (PathService::Get(base::DIR_MODULE, &module_path)) | 601 if (PathService::Get(base::DIR_MODULE, &module_path)) |
| 602 media::InitializeMediaLibrary(module_path); | 602 media::InitializeMediaLibrary(module_path); |
| 603 | 603 |
| 604 // Remoting requires NSS to function properly. It is not used for other | 604 // Remoting requires NSS to function properly. |
| 605 // reasons so load NSS only if remoting is enabled. | 605 base::LoadNSSLibraries(); |
|
wtc
2011/03/17 20:03:55
IMPORTANT: why don't you need to disable the NSS f
Alpha Left Google
2011/03/17 22:31:34
Because we want to initalize only in the renderer
wtc
2011/03/18 18:46:31
Did you mean the renderer process cannot load any
Alpha Left Google
2011/03/18 18:49:12
When the renderer process starts (it is forked fro
| |
| 606 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 607 if (command_line.HasSwitch(switches::kEnableRemoting)) { | |
| 608 // We are going to fork to engage the sandbox and we have not loaded | |
| 609 // any security modules so it is safe to disable the fork check in NSS. | |
| 610 base::DisableNSSForkCheck(); | |
| 611 | |
| 612 // Initialize NSS so that we load the necessary library files | |
| 613 // before we enter the sandbox. | |
| 614 base::ForceNSSNoDBInit(); | |
| 615 base::EnsureNSSInit(); | |
| 616 } | |
| 617 | 606 |
| 618 // Ensure access to the Pepper plugins before the sandbox is turned on. | 607 // Ensure access to the Pepper plugins before the sandbox is turned on. |
| 619 PepperPluginRegistry::PreloadModules(); | 608 PepperPluginRegistry::PreloadModules(); |
| 620 } | 609 } |
| 621 | 610 |
| 622 #if !defined(CHROMIUM_SELINUX) | 611 #if !defined(CHROMIUM_SELINUX) |
| 623 static bool EnterSandbox() { | 612 static bool EnterSandbox() { |
| 624 // The SUID sandbox sets this environment variable to a file descriptor | 613 // The SUID sandbox sets this environment variable to a file descriptor |
| 625 // over which we can signal that we have completed our startup and can be | 614 // over which we can signal that we have completed our startup and can be |
| 626 // chrooted. | 615 // chrooted. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 762 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 751 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
| 763 sandbox_flags |= ZygoteHost::kSandboxSeccomp; | 752 sandbox_flags |= ZygoteHost::kSandboxSeccomp; |
| 764 } | 753 } |
| 765 } | 754 } |
| 766 #endif // SECCOMP_SANDBOX | 755 #endif // SECCOMP_SANDBOX |
| 767 | 756 |
| 768 Zygote zygote(sandbox_flags); | 757 Zygote zygote(sandbox_flags); |
| 769 // This function call can return multiple times, once per fork(). | 758 // This function call can return multiple times, once per fork(). |
| 770 return zygote.ProcessRequests(); | 759 return zygote.ProcessRequests(); |
| 771 } | 760 } |
| OLD | NEW |