| 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 <dlfcn.h> | 5 #include <dlfcn.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <pthread.h> | 7 #include <pthread.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "content/common/sandbox_linux.h" | 30 #include "content/common/sandbox_linux.h" |
| 31 #include "content/common/zygote_commands_linux.h" | 31 #include "content/common/zygote_commands_linux.h" |
| 32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 33 #include "content/public/common/main_function_params.h" | 33 #include "content/public/common/main_function_params.h" |
| 34 #include "content/public/common/sandbox_linux.h" | 34 #include "content/public/common/sandbox_linux.h" |
| 35 #include "content/public/common/zygote_fork_delegate_linux.h" | 35 #include "content/public/common/zygote_fork_delegate_linux.h" |
| 36 #include "content/zygote/zygote_linux.h" | 36 #include "content/zygote/zygote_linux.h" |
| 37 #include "crypto/nss_util.h" | 37 #include "crypto/nss_util.h" |
| 38 #include "sandbox/linux/services/libc_urandom_override.h" | 38 #include "sandbox/linux/services/libc_urandom_override.h" |
| 39 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" | 39 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" |
| 40 #include "skia/ext/SkFontHost_fontconfig_control.h" |
| 40 #include "third_party/icu/public/i18n/unicode/timezone.h" | 41 #include "third_party/icu/public/i18n/unicode/timezone.h" |
| 41 #include "third_party/skia/include/ports/SkFontConfigInterface.h" | |
| 42 | 42 |
| 43 #if defined(OS_LINUX) | 43 #if defined(OS_LINUX) |
| 44 #include <sys/epoll.h> | 44 #include <sys/epoll.h> |
| 45 #include <sys/prctl.h> | 45 #include <sys/prctl.h> |
| 46 #include <sys/signal.h> | 46 #include <sys/signal.h> |
| 47 #else | 47 #else |
| 48 #include <signal.h> | 48 #include <signal.h> |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 namespace content { | 51 namespace content { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // This will set the *using_suid_sandbox variable to true if the SUID sandbox | 361 // This will set the *using_suid_sandbox variable to true if the SUID sandbox |
| 362 // is enabled. This does not necessarily exclude other types of sandboxing. | 362 // is enabled. This does not necessarily exclude other types of sandboxing. |
| 363 static bool EnterSandbox(sandbox::SetuidSandboxClient* setuid_sandbox, | 363 static bool EnterSandbox(sandbox::SetuidSandboxClient* setuid_sandbox, |
| 364 bool* using_suid_sandbox, bool* has_started_new_init) { | 364 bool* using_suid_sandbox, bool* has_started_new_init) { |
| 365 *using_suid_sandbox = false; | 365 *using_suid_sandbox = false; |
| 366 *has_started_new_init = false; | 366 *has_started_new_init = false; |
| 367 if (!setuid_sandbox) | 367 if (!setuid_sandbox) |
| 368 return false; | 368 return false; |
| 369 | 369 |
| 370 PreSandboxInit(); | 370 PreSandboxInit(); |
| 371 SkFontConfigInterface::SetGlobal( | 371 SkiaFontConfigSetImplementation( |
| 372 new FontConfigIPC(Zygote::kMagicSandboxIPCDescriptor))->unref(); | 372 new FontConfigIPC(Zygote::kMagicSandboxIPCDescriptor)); |
| 373 | 373 |
| 374 if (setuid_sandbox->IsSuidSandboxChild()) { | 374 if (setuid_sandbox->IsSuidSandboxChild()) { |
| 375 // Use the SUID sandbox. This still allows the seccomp sandbox to | 375 // Use the SUID sandbox. This still allows the seccomp sandbox to |
| 376 // be enabled by the process later. | 376 // be enabled by the process later. |
| 377 *using_suid_sandbox = true; | 377 *using_suid_sandbox = true; |
| 378 | 378 |
| 379 if (!setuid_sandbox->IsSuidSandboxUpToDate()) { | 379 if (!setuid_sandbox->IsSuidSandboxUpToDate()) { |
| 380 LOG(WARNING) << "You are using a wrong version of the setuid binary!\n" | 380 LOG(WARNING) << "You are using a wrong version of the setuid binary!\n" |
| 381 "Please read " | 381 "Please read " |
| 382 "https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment." | 382 "https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment." |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 431 |
| 432 static bool EnterSandbox(sandbox::SetuidSandboxClient* setuid_sandbox, | 432 static bool EnterSandbox(sandbox::SetuidSandboxClient* setuid_sandbox, |
| 433 bool* using_suid_sandbox, bool* has_started_new_init) { | 433 bool* using_suid_sandbox, bool* has_started_new_init) { |
| 434 *using_suid_sandbox = false; | 434 *using_suid_sandbox = false; |
| 435 *has_started_new_init = false; | 435 *has_started_new_init = false; |
| 436 | 436 |
| 437 if (!setuid_sandbox) | 437 if (!setuid_sandbox) |
| 438 return false; | 438 return false; |
| 439 | 439 |
| 440 PreSandboxInit(); | 440 PreSandboxInit(); |
| 441 SkFontConfigInterface::SetGlobal( | 441 SkiaFontConfigSetImplementation( |
| 442 new FontConfigIPC(Zygote::kMagicSandboxIPCDescriptor)))->unref(); | 442 new FontConfigIPC(Zygote::kMagicSandboxIPCDescriptor)); |
| 443 return true; | 443 return true; |
| 444 } | 444 } |
| 445 | 445 |
| 446 #endif // CHROMIUM_SELINUX | 446 #endif // CHROMIUM_SELINUX |
| 447 | 447 |
| 448 bool ZygoteMain(const MainFunctionParams& params, | 448 bool ZygoteMain(const MainFunctionParams& params, |
| 449 ZygoteForkDelegate* forkdelegate) { | 449 ZygoteForkDelegate* forkdelegate) { |
| 450 #if !defined(CHROMIUM_SELINUX) | 450 #if !defined(CHROMIUM_SELINUX) |
| 451 g_am_zygote_or_renderer = true; | 451 g_am_zygote_or_renderer = true; |
| 452 sandbox::InitLibcUrandomOverrides(); | 452 sandbox::InitLibcUrandomOverrides(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 488 } |
| 489 | 489 |
| 490 int sandbox_flags = linux_sandbox->GetStatus(); | 490 int sandbox_flags = linux_sandbox->GetStatus(); |
| 491 | 491 |
| 492 Zygote zygote(sandbox_flags, forkdelegate); | 492 Zygote zygote(sandbox_flags, forkdelegate); |
| 493 // This function call can return multiple times, once per fork(). | 493 // This function call can return multiple times, once per fork(). |
| 494 return zygote.ProcessRequests(); | 494 return zygote.ProcessRequests(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace content | 497 } // namespace content |
| OLD | NEW |