| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/zygote/zygote_main.h" | 5 #include "content/zygote/zygote_main.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 <signal.h> | 10 #include <signal.h> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "content/common/child_process_sandbox_support_impl_linux.h" | 37 #include "content/common/child_process_sandbox_support_impl_linux.h" |
| 38 #include "content/common/font_config_ipc_linux.h" | 38 #include "content/common/font_config_ipc_linux.h" |
| 39 #include "content/common/sandbox_linux/sandbox_debug_handling_linux.h" | 39 #include "content/common/sandbox_linux/sandbox_debug_handling_linux.h" |
| 40 #include "content/common/sandbox_linux/sandbox_linux.h" | 40 #include "content/common/sandbox_linux/sandbox_linux.h" |
| 41 #include "content/common/zygote_commands_linux.h" | 41 #include "content/common/zygote_commands_linux.h" |
| 42 #include "content/public/common/content_switches.h" | 42 #include "content/public/common/content_switches.h" |
| 43 #include "content/public/common/main_function_params.h" | 43 #include "content/public/common/main_function_params.h" |
| 44 #include "content/public/common/sandbox_linux.h" | 44 #include "content/public/common/sandbox_linux.h" |
| 45 #include "content/public/common/zygote_fork_delegate_linux.h" | 45 #include "content/public/common/zygote_fork_delegate_linux.h" |
| 46 #include "content/zygote/zygote_linux.h" | 46 #include "content/zygote/zygote_linux.h" |
| 47 #include "media/media_features.h" |
| 47 #include "ppapi/features/features.h" | 48 #include "ppapi/features/features.h" |
| 48 #include "sandbox/linux/services/credentials.h" | 49 #include "sandbox/linux/services/credentials.h" |
| 49 #include "sandbox/linux/services/init_process_reaper.h" | 50 #include "sandbox/linux/services/init_process_reaper.h" |
| 50 #include "sandbox/linux/services/namespace_sandbox.h" | 51 #include "sandbox/linux/services/namespace_sandbox.h" |
| 51 #include "sandbox/linux/services/thread_helpers.h" | 52 #include "sandbox/linux/services/thread_helpers.h" |
| 52 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" | 53 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" |
| 53 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" | 54 #include "third_party/WebKit/public/web/linux/WebFontRendering.h" |
| 54 #include "third_party/boringssl/src/include/openssl/crypto.h" | 55 #include "third_party/boringssl/src/include/openssl/crypto.h" |
| 55 #include "third_party/boringssl/src/include/openssl/rand.h" | 56 #include "third_party/boringssl/src/include/openssl/rand.h" |
| 56 #include "third_party/icu/source/i18n/unicode/timezone.h" | 57 #include "third_party/icu/source/i18n/unicode/timezone.h" |
| 57 #include "third_party/skia/include/ports/SkFontConfigInterface.h" | 58 #include "third_party/skia/include/ports/SkFontConfigInterface.h" |
| 58 #include "third_party/skia/include/ports/SkFontMgr_android.h" | 59 #include "third_party/skia/include/ports/SkFontMgr_android.h" |
| 59 | 60 |
| 60 #if defined(OS_LINUX) | 61 #if defined(OS_LINUX) |
| 61 #include <sys/prctl.h> | 62 #include <sys/prctl.h> |
| 62 #endif | 63 #endif |
| 63 | 64 |
| 64 #if BUILDFLAG(ENABLE_PLUGINS) | 65 #if BUILDFLAG(ENABLE_PLUGINS) |
| 65 #include "content/common/pepper_plugin_list.h" | 66 #include "content/common/pepper_plugin_list.h" |
| 66 #include "content/public/common/pepper_plugin_info.h" | 67 #include "content/public/common/pepper_plugin_info.h" |
| 67 #endif | 68 #endif |
| 68 | 69 |
| 69 #if defined(ENABLE_WEBRTC) | 70 #if BUILDFLAG(ENABLE_WEBRTC) |
| 70 #include "third_party/webrtc_overrides/init_webrtc.h" | 71 #include "third_party/webrtc_overrides/init_webrtc.h" |
| 71 #endif | 72 #endif |
| 72 | 73 |
| 73 #if defined(SANITIZER_COVERAGE) | 74 #if defined(SANITIZER_COVERAGE) |
| 74 #include <sanitizer/common_interface_defs.h> | 75 #include <sanitizer/common_interface_defs.h> |
| 75 #include <sanitizer/coverage_interface.h> | 76 #include <sanitizer/coverage_interface.h> |
| 76 #endif | 77 #endif |
| 77 | 78 |
| 78 namespace content { | 79 namespace content { |
| 79 | 80 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 #endif | 356 #endif |
| 356 | 357 |
| 357 // Pass BoringSSL a copy of the /dev/urandom file descriptor so RAND_bytes | 358 // Pass BoringSSL a copy of the /dev/urandom file descriptor so RAND_bytes |
| 358 // will work inside the sandbox. | 359 // will work inside the sandbox. |
| 359 RAND_set_urandom_fd(base::GetUrandomFD()); | 360 RAND_set_urandom_fd(base::GetUrandomFD()); |
| 360 | 361 |
| 361 #if BUILDFLAG(ENABLE_PLUGINS) | 362 #if BUILDFLAG(ENABLE_PLUGINS) |
| 362 // Ensure access to the Pepper plugins before the sandbox is turned on. | 363 // Ensure access to the Pepper plugins before the sandbox is turned on. |
| 363 PreloadPepperPlugins(); | 364 PreloadPepperPlugins(); |
| 364 #endif | 365 #endif |
| 365 #if defined(ENABLE_WEBRTC) | 366 #if BUILDFLAG(ENABLE_WEBRTC) |
| 366 InitializeWebRtcModule(); | 367 InitializeWebRtcModule(); |
| 367 #endif | 368 #endif |
| 368 | 369 |
| 369 SkFontConfigInterface::SetGlobal( | 370 SkFontConfigInterface::SetGlobal( |
| 370 new FontConfigIPC(GetSandboxFD()))->unref(); | 371 new FontConfigIPC(GetSandboxFD()))->unref(); |
| 371 | 372 |
| 372 // Set the android SkFontMgr for blink. We need to ensure this is done | 373 // Set the android SkFontMgr for blink. We need to ensure this is done |
| 373 // before the sandbox is initialized to allow the font manager to access | 374 // before the sandbox is initialized to allow the font manager to access |
| 374 // font configuration files on disk. | 375 // font configuration files on disk. |
| 375 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 376 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; | 665 const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; |
| 665 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); | 666 CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); |
| 666 | 667 |
| 667 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, | 668 Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, |
| 668 extra_fds); | 669 extra_fds); |
| 669 // This function call can return multiple times, once per fork(). | 670 // This function call can return multiple times, once per fork(). |
| 670 return zygote.ProcessRequests(); | 671 return zygote.ProcessRequests(); |
| 671 } | 672 } |
| 672 | 673 |
| 673 } // namespace content | 674 } // namespace content |
| OLD | NEW |