| 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 <stdio.h> | 10 #include <stdio.h> |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 449 |
| 450 bool ZygoteMain(const MainFunctionParams& params, | 450 bool ZygoteMain(const MainFunctionParams& params, |
| 451 ZygoteForkDelegate* forkdelegate) { | 451 ZygoteForkDelegate* forkdelegate) { |
| 452 #if !defined(CHROMIUM_SELINUX) | 452 #if !defined(CHROMIUM_SELINUX) |
| 453 g_am_zygote_or_renderer = true; | 453 g_am_zygote_or_renderer = true; |
| 454 sandbox::InitLibcUrandomOverrides(); | 454 sandbox::InitLibcUrandomOverrides(); |
| 455 #endif | 455 #endif |
| 456 | 456 |
| 457 LinuxSandbox* linux_sandbox = LinuxSandbox::GetInstance(); | 457 LinuxSandbox* linux_sandbox = LinuxSandbox::GetInstance(); |
| 458 // This will pre-initialize the various sandboxes that need it. | 458 // This will pre-initialize the various sandboxes that need it. |
| 459 // There need to be a corresponding call to PreinitializeSandboxFinish() | 459 linux_sandbox->PreinitializeSandbox(); |
| 460 // for each new process, this will be done in the Zygote child, once we know | |
| 461 // our process type. | |
| 462 linux_sandbox->PreinitializeSandboxBegin(); | |
| 463 | 460 |
| 464 sandbox::SetuidSandboxClient* setuid_sandbox = | 461 sandbox::SetuidSandboxClient* setuid_sandbox = |
| 465 linux_sandbox->setuid_sandbox_client(); | 462 linux_sandbox->setuid_sandbox_client(); |
| 466 | 463 |
| 467 if (forkdelegate != NULL) { | 464 if (forkdelegate != NULL) { |
| 468 VLOG(1) << "ZygoteMain: initializing fork delegate"; | 465 VLOG(1) << "ZygoteMain: initializing fork delegate"; |
| 469 forkdelegate->Init(Zygote::kMagicSandboxIPCDescriptor); | 466 forkdelegate->Init(Zygote::kMagicSandboxIPCDescriptor); |
| 470 } else { | 467 } else { |
| 471 VLOG(1) << "ZygoteMain: fork delegate is NULL"; | 468 VLOG(1) << "ZygoteMain: fork delegate is NULL"; |
| 472 } | 469 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 490 } | 487 } |
| 491 | 488 |
| 492 int sandbox_flags = linux_sandbox->GetStatus(); | 489 int sandbox_flags = linux_sandbox->GetStatus(); |
| 493 | 490 |
| 494 Zygote zygote(sandbox_flags, forkdelegate); | 491 Zygote zygote(sandbox_flags, forkdelegate); |
| 495 // This function call can return multiple times, once per fork(). | 492 // This function call can return multiple times, once per fork(). |
| 496 return zygote.ProcessRequests(); | 493 return zygote.ProcessRequests(); |
| 497 } | 494 } |
| 498 | 495 |
| 499 } // namespace content | 496 } // namespace content |
| OLD | NEW |