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" |
| 6 |
5 #include <dlfcn.h> | 7 #include <dlfcn.h> |
6 #include <fcntl.h> | 8 #include <fcntl.h> |
7 #include <pthread.h> | 9 #include <pthread.h> |
8 #include <sys/epoll.h> | |
9 #include <sys/prctl.h> | |
10 #include <sys/signal.h> | |
11 #include <sys/socket.h> | 10 #include <sys/socket.h> |
12 #include <sys/stat.h> | 11 #include <sys/stat.h> |
13 #include <sys/types.h> | 12 #include <sys/types.h> |
14 #include <sys/wait.h> | 13 #include <sys/wait.h> |
15 #include <unistd.h> | 14 #include <unistd.h> |
16 | 15 |
17 #if defined(CHROMIUM_SELINUX) | |
18 #include <selinux/selinux.h> | |
19 #include <selinux/context.h> | |
20 #endif | |
21 | |
22 #include "content/browser/zygote_host_linux.h" | |
23 | |
24 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
25 #include "base/command_line.h" | 17 #include "base/command_line.h" |
26 #include "base/eintr_wrapper.h" | 18 #include "base/eintr_wrapper.h" |
27 #include "base/file_path.h" | 19 #include "base/file_path.h" |
28 #include "base/global_descriptors_posix.h" | 20 #include "base/global_descriptors_posix.h" |
29 #include "base/hash_tables.h" | 21 #include "base/hash_tables.h" |
30 #include "base/linux_util.h" | 22 #include "base/linux_util.h" |
31 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
32 #include "base/path_service.h" | 24 #include "base/path_service.h" |
33 #include "base/pickle.h" | 25 #include "base/pickle.h" |
(...skipping 11 matching lines...) Expand all Loading... |
45 #include "content/common/process_watcher.h" | 37 #include "content/common/process_watcher.h" |
46 #include "content/common/result_codes.h" | 38 #include "content/common/result_codes.h" |
47 #include "content/common/sandbox_methods_linux.h" | 39 #include "content/common/sandbox_methods_linux.h" |
48 #include "content/common/set_process_title.h" | 40 #include "content/common/set_process_title.h" |
49 #include "content/common/unix_domain_socket_posix.h" | 41 #include "content/common/unix_domain_socket_posix.h" |
50 #include "media/base/media.h" | 42 #include "media/base/media.h" |
51 #include "seccompsandbox/sandbox.h" | 43 #include "seccompsandbox/sandbox.h" |
52 #include "skia/ext/SkFontHost_fontconfig_control.h" | 44 #include "skia/ext/SkFontHost_fontconfig_control.h" |
53 #include "unicode/timezone.h" | 45 #include "unicode/timezone.h" |
54 | 46 |
| 47 #if defined(OS_LINUX) |
| 48 #include <sys/epoll.h> |
| 49 #include <sys/prctl.h> |
| 50 #include <sys/signal.h> |
| 51 #else |
| 52 #include <signal.h> |
| 53 #endif |
| 54 |
| 55 #if defined(CHROMIUM_SELINUX) |
| 56 #include <selinux/selinux.h> |
| 57 #include <selinux/context.h> |
| 58 #endif |
| 59 |
55 #if defined(ARCH_CPU_X86_FAMILY) && !defined(CHROMIUM_SELINUX) && \ | 60 #if defined(ARCH_CPU_X86_FAMILY) && !defined(CHROMIUM_SELINUX) && \ |
56 !defined(__clang__) | 61 !defined(__clang__) |
57 // The seccomp sandbox is enabled on all ia32 and x86-64 processor as long as | 62 // The seccomp sandbox is enabled on all ia32 and x86-64 processor as long as |
58 // we aren't using SELinux or clang. | 63 // we aren't using SELinux or clang. |
59 #define SECCOMP_SANDBOX | 64 #define SECCOMP_SANDBOX |
60 #endif | 65 #endif |
61 | 66 |
62 // http://code.google.com/p/chromium/wiki/LinuxZygote | 67 // http://code.google.com/p/chromium/wiki/LinuxZygote |
63 | 68 |
64 static const int kBrowserDescriptor = 3; | 69 static const int kBrowserDescriptor = 3; |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 VLOG(1) << "Enabling experimental Seccomp sandbox."; | 766 VLOG(1) << "Enabling experimental Seccomp sandbox."; |
762 sandbox_flags |= ZygoteHost::kSandboxSeccomp; | 767 sandbox_flags |= ZygoteHost::kSandboxSeccomp; |
763 } | 768 } |
764 } | 769 } |
765 #endif // SECCOMP_SANDBOX | 770 #endif // SECCOMP_SANDBOX |
766 | 771 |
767 Zygote zygote(sandbox_flags); | 772 Zygote zygote(sandbox_flags); |
768 // This function call can return multiple times, once per fork(). | 773 // This function call can return multiple times, once per fork(). |
769 return zygote.ProcessRequests(); | 774 return zygote.ProcessRequests(); |
770 } | 775 } |
OLD | NEW |