| 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 #ifndef CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 #if defined(OS_LINUX) | 51 #if defined(OS_LINUX) |
| 52 // Indicates that the child execed after forking may be execced from | 52 // Indicates that the child execed after forking may be execced from |
| 53 // /proc/self/exe rather than using the "real" app path. This prevents | 53 // /proc/self/exe rather than using the "real" app path. This prevents |
| 54 // autoupdate from confusing us if it changes the file out from under us. | 54 // autoupdate from confusing us if it changes the file out from under us. |
| 55 // You will generally want to set this on Linux, except when there is an | 55 // You will generally want to set this on Linux, except when there is an |
| 56 // override to the command line (for example, we're forking a renderer in | 56 // override to the command line (for example, we're forking a renderer in |
| 57 // gdb). In this case, you'd use GetChildPath to get the real executable | 57 // gdb). In this case, you'd use GetChildPath to get the real executable |
| 58 // file name, and then prepend the GDB command to the command line. | 58 // file name, and then prepend the GDB command to the command line. |
| 59 CHILD_ALLOW_SELF = 1 << 0, | 59 CHILD_ALLOW_SELF = 1 << 0, |
| 60 #elif defined(OS_MACOSX) | 60 #endif // defined(OS_LINUX) |
| 61 | |
| 62 // Requests that the child run in a process that does not have the | |
| 63 // PIE (position-independent executable) bit set, effectively disabling | |
| 64 // ASLR. For process types that need to allocate a large contiguous | |
| 65 // region, ASLR may not leave a large enough "hole" for the purpose. This | |
| 66 // option should be used sparingly, and only when absolutely necessary. | |
| 67 // This option is currently incompatible with CHILD_ALLOW_HEAP_EXECUTION. | |
| 68 CHILD_NO_PIE = 1 << 1, | |
| 69 | |
| 70 // Requests that the child run in a process that does not protect the | |
| 71 // heap against execution. Normally, heap pages may be made executable | |
| 72 // with mprotect, so this mode should be used sparingly. It is intended | |
| 73 // for processes that may host plugins that expect an executable heap | |
| 74 // without having to call mprotect. This option is currently incompatible | |
| 75 // with CHILD_NO_PIE. | |
| 76 CHILD_ALLOW_HEAP_EXECUTION = 1 << 2, | |
| 77 #endif | |
| 78 }; | 61 }; |
| 79 | 62 |
| 80 // Returns the pathname to be used for a child process. If a subprocess | 63 // Returns the pathname to be used for a child process. If a subprocess |
| 81 // pathname was specified on the command line, that will be used. Otherwise, | 64 // pathname was specified on the command line, that will be used. Otherwise, |
| 82 // the default child process pathname will be returned. On most platforms, | 65 // the default child process pathname will be returned. On most platforms, |
| 83 // this will be the same as the currently-executing process. | 66 // this will be the same as the currently-executing process. |
| 84 // | 67 // |
| 85 // The |flags| argument accepts one or more flags such as CHILD_ALLOW_SELF | 68 // The |flags| argument accepts one or more flags such as CHILD_ALLOW_SELF. |
| 86 // and CHILD_ALLOW_HEAP_EXECUTION as defined above. Pass only CHILD_NORMAL | 69 // Pass only CHILD_NORMAL if none of these special behaviors are required. |
| 87 // if none of these special behaviors are required. | |
| 88 // | 70 // |
| 89 // On failure, returns an empty FilePath. | 71 // On failure, returns an empty FilePath. |
| 90 static base::FilePath GetChildPath(int flags); | 72 static base::FilePath GetChildPath(int flags); |
| 91 | 73 |
| 92 // Returns an AttachmentBroker used to broker attachments of IPC messages to | 74 // Returns an AttachmentBroker used to broker attachments of IPC messages to |
| 93 // child processes. | 75 // child processes. |
| 94 static IPC::AttachmentBrokerPrivileged* GetAttachmentBroker(); | 76 static IPC::AttachmentBrokerPrivileged* GetAttachmentBroker(); |
| 95 | 77 |
| 96 // Send the shutdown message to the child process. | 78 // Send the shutdown message to the child process. |
| 97 // Does not check with the delegate's CanShutdown. | 79 // Does not check with the delegate's CanShutdown. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 109 | 91 |
| 110 #if defined(OS_POSIX) | 92 #if defined(OS_POSIX) |
| 111 // See IPC::Channel::TakeClientFileDescriptor. | 93 // See IPC::Channel::TakeClientFileDescriptor. |
| 112 virtual base::ScopedFD TakeClientFileDescriptor() = 0; | 94 virtual base::ScopedFD TakeClientFileDescriptor() = 0; |
| 113 #endif | 95 #endif |
| 114 }; | 96 }; |
| 115 | 97 |
| 116 }; // namespace content | 98 }; // namespace content |
| 117 | 99 |
| 118 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ | 100 #endif // CONTENT_PUBLIC_COMMON_CHILD_PROCESS_HOST_H_ |
| OLD | NEW |