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_linux.h" | 5 #include "content/zygote/zygote_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/common/set_process_title.h" | 30 #include "content/common/set_process_title.h" |
31 #include "content/common/zygote_commands_linux.h" | 31 #include "content/common/zygote_commands_linux.h" |
32 #include "content/public/common/content_descriptors.h" | 32 #include "content/public/common/content_descriptors.h" |
33 #include "content/public/common/result_codes.h" | 33 #include "content/public/common/result_codes.h" |
34 #include "content/public/common/sandbox_linux.h" | 34 #include "content/public/common/sandbox_linux.h" |
35 #include "content/public/common/send_zygote_child_ping_linux.h" | 35 #include "content/public/common/send_zygote_child_ping_linux.h" |
36 #include "content/public/common/zygote_fork_delegate_linux.h" | 36 #include "content/public/common/zygote_fork_delegate_linux.h" |
37 #include "ipc/ipc_channel.h" | 37 #include "ipc/ipc_channel.h" |
38 #include "ipc/ipc_switches.h" | 38 #include "ipc/ipc_switches.h" |
39 | 39 |
40 #if defined(ADDRESS_SANITIZER) | |
41 #include <sanitizer/asan_interface.h> | |
42 #endif | |
43 | |
44 // See http://code.google.com/p/chromium/wiki/LinuxZygote | 40 // See http://code.google.com/p/chromium/wiki/LinuxZygote |
45 | 41 |
46 namespace content { | 42 namespace content { |
47 | 43 |
48 namespace { | 44 namespace { |
49 | 45 |
50 // NOP function. See below where this handler is installed. | 46 // NOP function. See below where this handler is installed. |
51 void SIGCHLDHandler(int signal) { | 47 void SIGCHLDHandler(int signal) { |
52 } | 48 } |
53 | 49 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 154 |
159 if (len == 0 || (len == -1 && errno == ECONNRESET)) { | 155 if (len == 0 || (len == -1 && errno == ECONNRESET)) { |
160 // EOF from the browser. We should die. | 156 // EOF from the browser. We should die. |
161 // TODO(earthdok): call __sanititizer_cov_dump() here to obtain code | 157 // TODO(earthdok): call __sanititizer_cov_dump() here to obtain code |
162 // coverage for the Zygote. Currently it's not possible because of | 158 // coverage for the Zygote. Currently it's not possible because of |
163 // confusion over who is responsible for closing the file descriptor. | 159 // confusion over who is responsible for closing the file descriptor. |
164 for (std::vector<int>::iterator it = extra_fds_.begin(); | 160 for (std::vector<int>::iterator it = extra_fds_.begin(); |
165 it < extra_fds_.end(); ++it) { | 161 it < extra_fds_.end(); ++it) { |
166 PCHECK(0 == IGNORE_EINTR(close(*it))); | 162 PCHECK(0 == IGNORE_EINTR(close(*it))); |
167 } | 163 } |
168 #if !defined(ADDRESS_SANITIZER) | 164 #if !defined(SANITIZER_COVERAGE) |
169 // TODO(earthdok): add watchdog thread before using this in non-ASAN builds. | 165 // TODO(earthdok): add watchdog thread before using this in builds not |
| 166 // using sanitizer coverage. |
170 CHECK(extra_children_.empty()); | 167 CHECK(extra_children_.empty()); |
171 #endif | 168 #endif |
172 for (std::vector<base::ProcessHandle>::iterator it = | 169 for (std::vector<base::ProcessHandle>::iterator it = |
173 extra_children_.begin(); | 170 extra_children_.begin(); |
174 it < extra_children_.end(); ++it) { | 171 it < extra_children_.end(); ++it) { |
175 PCHECK(*it == HANDLE_EINTR(waitpid(*it, NULL, 0))); | 172 PCHECK(*it == HANDLE_EINTR(waitpid(*it, NULL, 0))); |
176 } | 173 } |
177 _exit(0); | 174 _exit(0); |
178 return false; | 175 return false; |
179 } | 176 } |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 PickleIterator iter) { | 581 PickleIterator iter) { |
585 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 582 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
586 sizeof(sandbox_flags_)) { | 583 sizeof(sandbox_flags_)) { |
587 PLOG(ERROR) << "write"; | 584 PLOG(ERROR) << "write"; |
588 } | 585 } |
589 | 586 |
590 return false; | 587 return false; |
591 } | 588 } |
592 | 589 |
593 } // namespace content | 590 } // namespace content |
OLD | NEW |