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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. It is not used for other |
605 // reasons so load NSS only if remoting is enabled. | 605 // reasons so load NSS only if remoting is enabled. |
606 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 606 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
607 if (command_line.HasSwitch(switches::kEnableRemoting)) { | 607 if (command_line.HasSwitch(switches::kEnableRemoting)) { |
608 // We are going to fork to engage the sandbox and we have not loaded | 608 base::LoadNSSLibraries(); |
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 } | 609 } |
617 | 610 |
618 // Ensure access to the Pepper plugins before the sandbox is turned on. | 611 // Ensure access to the Pepper plugins before the sandbox is turned on. |
619 PepperPluginRegistry::PreloadModules(); | 612 PepperPluginRegistry::PreloadModules(); |
620 } | 613 } |
621 | 614 |
622 #if !defined(CHROMIUM_SELINUX) | 615 #if !defined(CHROMIUM_SELINUX) |
623 static bool EnterSandbox() { | 616 static bool EnterSandbox() { |
624 // The SUID sandbox sets this environment variable to a file descriptor | 617 // 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 | 618 // over which we can signal that we have completed our startup and can be |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 755 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
763 sandbox_flags |= ZygoteHost::kSandboxSeccomp; | 756 sandbox_flags |= ZygoteHost::kSandboxSeccomp; |
764 } | 757 } |
765 } | 758 } |
766 #endif // SECCOMP_SANDBOX | 759 #endif // SECCOMP_SANDBOX |
767 | 760 |
768 Zygote zygote(sandbox_flags); | 761 Zygote zygote(sandbox_flags); |
769 // This function call can return multiple times, once per fork(). | 762 // This function call can return multiple times, once per fork(). |
770 return zygote.ProcessRequests(); | 763 return zygote.ProcessRequests(); |
771 } | 764 } |
OLD | NEW |