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 24 matching lines...) Expand all Loading... |
35 #include "build/build_config.h" | 35 #include "build/build_config.h" |
36 #include "chrome/browser/zygote_host_linux.h" | 36 #include "chrome/browser/zygote_host_linux.h" |
37 #include "chrome/common/chrome_descriptors.h" | 37 #include "chrome/common/chrome_descriptors.h" |
38 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/font_config_ipc_linux.h" | 39 #include "chrome/common/font_config_ipc_linux.h" |
40 #include "chrome/common/main_function_params.h" | 40 #include "chrome/common/main_function_params.h" |
41 #include "chrome/common/pepper_plugin_registry.h" | 41 #include "chrome/common/pepper_plugin_registry.h" |
42 #include "chrome/common/process_watcher.h" | 42 #include "chrome/common/process_watcher.h" |
43 #include "chrome/common/result_codes.h" | 43 #include "chrome/common/result_codes.h" |
44 #include "chrome/common/sandbox_methods_linux.h" | 44 #include "chrome/common/sandbox_methods_linux.h" |
| 45 #include "chrome/common/set_process_title.h" |
45 #include "chrome/common/unix_domain_socket_posix.h" | 46 #include "chrome/common/unix_domain_socket_posix.h" |
46 #include "media/base/media.h" | 47 #include "media/base/media.h" |
47 #include "seccompsandbox/sandbox.h" | 48 #include "seccompsandbox/sandbox.h" |
48 #include "skia/ext/SkFontHost_fontconfig_control.h" | 49 #include "skia/ext/SkFontHost_fontconfig_control.h" |
49 #include "unicode/timezone.h" | 50 #include "unicode/timezone.h" |
50 | 51 |
51 #if defined(ARCH_CPU_X86_FAMILY) && !defined(CHROMIUM_SELINUX) && \ | 52 #if defined(ARCH_CPU_X86_FAMILY) && !defined(CHROMIUM_SELINUX) && \ |
52 !defined(__clang__) | 53 !defined(__clang__) |
53 // The seccomp sandbox is enabled on all ia32 and x86-64 processor as long as | 54 // The seccomp sandbox is enabled on all ia32 and x86-64 processor as long as |
54 // we aren't using SELinux or clang. | 55 // we aren't using SELinux or clang. |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 base::GlobalDescriptors::GetInstance()->Reset(mapping); | 388 base::GlobalDescriptors::GetInstance()->Reset(mapping); |
388 | 389 |
389 #if defined(CHROMIUM_SELINUX) | 390 #if defined(CHROMIUM_SELINUX) |
390 SELinuxTransitionToTypeOrDie("chromium_renderer_t"); | 391 SELinuxTransitionToTypeOrDie("chromium_renderer_t"); |
391 #endif | 392 #endif |
392 | 393 |
393 // Reset the process-wide command line to our new command line. | 394 // Reset the process-wide command line to our new command line. |
394 CommandLine::Reset(); | 395 CommandLine::Reset(); |
395 CommandLine::Init(0, NULL); | 396 CommandLine::Init(0, NULL); |
396 CommandLine::ForCurrentProcess()->InitFromArgv(args); | 397 CommandLine::ForCurrentProcess()->InitFromArgv(args); |
397 CommandLine::SetProcTitle(); | 398 |
| 399 // Update the process title. The argv was already cached by the call to |
| 400 // SetProcessTitleFromCommandLine in ChromeMain, so we can pass NULL here |
| 401 // (we don't have the original argv at this point). |
| 402 SetProcessTitleFromCommandLine(NULL); |
| 403 |
398 // The fork() request is handled further up the call stack. | 404 // The fork() request is handled further up the call stack. |
399 return true; | 405 return true; |
400 } else if (child < 0) { | 406 } else if (child < 0) { |
401 LOG(ERROR) << "Zygote could not fork: " << errno; | 407 LOG(ERROR) << "Zygote could not fork: " << errno; |
402 goto error; | 408 goto error; |
403 } | 409 } |
404 | 410 |
405 for (std::vector<int>::const_iterator | 411 for (std::vector<int>::const_iterator |
406 i = fds.begin(); i != fds.end(); ++i) | 412 i = fds.begin(); i != fds.end(); ++i) |
407 close(*i); | 413 close(*i); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 749 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
744 sandbox_flags |= ZygoteHost::kSandboxSeccomp; | 750 sandbox_flags |= ZygoteHost::kSandboxSeccomp; |
745 } | 751 } |
746 } | 752 } |
747 #endif // SECCOMP_SANDBOX | 753 #endif // SECCOMP_SANDBOX |
748 | 754 |
749 Zygote zygote(sandbox_flags); | 755 Zygote zygote(sandbox_flags); |
750 // This function call can return multiple times, once per fork(). | 756 // This function call can return multiple times, once per fork(). |
751 return zygote.ProcessRequests(); | 757 return zygote.ProcessRequests(); |
752 } | 758 } |
OLD | NEW |