OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/zygote_host_linux.h" | 5 #include "content/browser/zygote_host_linux.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <pthread.h> | 9 #include <pthread.h> |
10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/linux_util.h" | 23 #include "base/linux_util.h" |
24 #include "base/memory/scoped_ptr.h" | 24 #include "base/memory/scoped_ptr.h" |
25 #include "base/pickle.h" | 25 #include "base/pickle.h" |
26 #include "base/process_util.h" | 26 #include "base/process_util.h" |
27 #include "base/rand_util.h" | 27 #include "base/rand_util.h" |
28 #include "base/sys_info.h" | 28 #include "base/sys_info.h" |
29 #include "build/build_config.h" | 29 #include "build/build_config.h" |
30 #include "crypto/nss_util.h" | 30 #include "crypto/nss_util.h" |
31 #include "content/common/chrome_descriptors.h" | 31 #include "content/common/chrome_descriptors.h" |
32 #include "content/common/font_config_ipc_linux.h" | 32 #include "content/common/font_config_ipc_linux.h" |
33 #include "content/common/main_function_params.h" | |
34 #include "content/common/pepper_plugin_registry.h" | 33 #include "content/common/pepper_plugin_registry.h" |
35 #include "content/common/process_watcher.h" | 34 #include "content/common/process_watcher.h" |
36 #include "content/common/sandbox_methods_linux.h" | 35 #include "content/common/sandbox_methods_linux.h" |
37 #include "content/common/seccomp_sandbox.h" | 36 #include "content/common/seccomp_sandbox.h" |
38 #include "content/common/set_process_title.h" | 37 #include "content/common/set_process_title.h" |
39 #include "content/common/unix_domain_socket_posix.h" | 38 #include "content/common/unix_domain_socket_posix.h" |
40 #include "content/public/common/content_switches.h" | 39 #include "content/public/common/content_switches.h" |
| 40 #include "content/public/common/main_function_params.h" |
41 #include "content/public/common/result_codes.h" | 41 #include "content/public/common/result_codes.h" |
42 #include "content/public/common/zygote_fork_delegate_linux.h" | 42 #include "content/public/common/zygote_fork_delegate_linux.h" |
43 #include "skia/ext/SkFontHost_fontconfig_control.h" | 43 #include "skia/ext/SkFontHost_fontconfig_control.h" |
44 #include "unicode/timezone.h" | 44 #include "unicode/timezone.h" |
45 #include "ipc/ipc_channel.h" | 45 #include "ipc/ipc_channel.h" |
46 #include "ipc/ipc_switches.h" | 46 #include "ipc/ipc_switches.h" |
47 | 47 |
48 #if defined(OS_LINUX) | 48 #if defined(OS_LINUX) |
49 #include <sys/epoll.h> | 49 #include <sys/epoll.h> |
50 #include <sys/prctl.h> | 50 #include <sys/prctl.h> |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 #else // CHROMIUM_SELINUX | 798 #else // CHROMIUM_SELINUX |
799 | 799 |
800 static bool EnterSandbox() { | 800 static bool EnterSandbox() { |
801 PreSandboxInit(); | 801 PreSandboxInit(); |
802 SkiaFontConfigUseIPCImplementation(kMagicSandboxIPCDescriptor); | 802 SkiaFontConfigUseIPCImplementation(kMagicSandboxIPCDescriptor); |
803 return true; | 803 return true; |
804 } | 804 } |
805 | 805 |
806 #endif // CHROMIUM_SELINUX | 806 #endif // CHROMIUM_SELINUX |
807 | 807 |
808 bool ZygoteMain(const MainFunctionParams& params, | 808 bool ZygoteMain(const content::MainFunctionParams& params, |
809 content::ZygoteForkDelegate* forkdelegate) { | 809 content::ZygoteForkDelegate* forkdelegate) { |
810 #if !defined(CHROMIUM_SELINUX) | 810 #if !defined(CHROMIUM_SELINUX) |
811 g_am_zygote_or_renderer = true; | 811 g_am_zygote_or_renderer = true; |
812 #endif | 812 #endif |
813 | 813 |
814 #if defined(SECCOMP_SANDBOX) | 814 #if defined(SECCOMP_SANDBOX) |
815 if (SeccompSandboxEnabled()) { | 815 if (SeccompSandboxEnabled()) { |
816 // The seccomp sandbox needs access to files in /proc, which might be denied | 816 // The seccomp sandbox needs access to files in /proc, which might be denied |
817 // after one of the other sandboxes have been started. So, obtain a suitable | 817 // after one of the other sandboxes have been started. So, obtain a suitable |
818 // file handle in advance. | 818 // file handle in advance. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 865 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
866 sandbox_flags |= ZygoteHost::kSandboxSeccomp; | 866 sandbox_flags |= ZygoteHost::kSandboxSeccomp; |
867 } | 867 } |
868 } | 868 } |
869 #endif // SECCOMP_SANDBOX | 869 #endif // SECCOMP_SANDBOX |
870 | 870 |
871 Zygote zygote(sandbox_flags, forkdelegate); | 871 Zygote zygote(sandbox_flags, forkdelegate); |
872 // This function call can return multiple times, once per fork(). | 872 // This function call can return multiple times, once per fork(). |
873 return zygote.ProcessRequests(); | 873 return zygote.ProcessRequests(); |
874 } | 874 } |
OLD | NEW |