Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: components/nacl/loader/nacl_helper_linux.cc

Issue 230413002: NonSFI NaCl: Plumb Exception IRT enough for breakpad. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // A mini-zygote specifically for Native Client. 5 // A mini-zygote specifically for Native Client.
6 6
7 #include "components/nacl/loader/nacl_helper_linux.h" 7 #include "components/nacl/loader/nacl_helper_linux.h"
8 8
9 #include <errno.h> 9 #include <errno.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 14 matching lines...) Expand all
25 #include "base/memory/scoped_ptr.h" 25 #include "base/memory/scoped_ptr.h"
26 #include "base/message_loop/message_loop.h" 26 #include "base/message_loop/message_loop.h"
27 #include "base/posix/eintr_wrapper.h" 27 #include "base/posix/eintr_wrapper.h"
28 #include "base/posix/global_descriptors.h" 28 #include "base/posix/global_descriptors.h"
29 #include "base/posix/unix_domain_socket_linux.h" 29 #include "base/posix/unix_domain_socket_linux.h"
30 #include "base/process/kill.h" 30 #include "base/process/kill.h"
31 #include "base/rand_util.h" 31 #include "base/rand_util.h"
32 #include "components/nacl/common/nacl_switches.h" 32 #include "components/nacl/common/nacl_switches.h"
33 #include "components/nacl/loader/nacl_listener.h" 33 #include "components/nacl/loader/nacl_listener.h"
34 #include "components/nacl/loader/nacl_sandbox_linux.h" 34 #include "components/nacl/loader/nacl_sandbox_linux.h"
35 #include "components/nacl/loader/nonsfi/irt_exception_handling.h"
35 #include "content/public/common/zygote_fork_delegate_linux.h" 36 #include "content/public/common/zygote_fork_delegate_linux.h"
36 #include "crypto/nss_util.h" 37 #include "crypto/nss_util.h"
37 #include "ipc/ipc_descriptors.h" 38 #include "ipc/ipc_descriptors.h"
38 #include "ipc/ipc_switches.h" 39 #include "ipc/ipc_switches.h"
39 #include "sandbox/linux/services/credentials.h" 40 #include "sandbox/linux/services/credentials.h"
40 #include "sandbox/linux/services/libc_urandom_override.h" 41 #include "sandbox/linux/services/libc_urandom_override.h"
41 #include "sandbox/linux/services/thread_helpers.h" 42 #include "sandbox/linux/services/thread_helpers.h"
42 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" 43 #include "sandbox/linux/suid/client/setuid_sandbox_client.h"
43 44
44 namespace { 45 namespace {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // The child must mimic the behavior of zygote_main_linux.cc on the child 115 // The child must mimic the behavior of zygote_main_linux.cc on the child
115 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from 116 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from
116 // if (!child) { 117 // if (!child) {
117 void BecomeNaClLoader(const std::vector<int>& child_fds, 118 void BecomeNaClLoader(const std::vector<int>& child_fds,
118 const NaClLoaderSystemInfo& system_info, 119 const NaClLoaderSystemInfo& system_info,
119 bool uses_nonsfi_mode) { 120 bool uses_nonsfi_mode) {
120 VLOG(1) << "NaCl loader: setting up IPC descriptor"; 121 VLOG(1) << "NaCl loader: setting up IPC descriptor";
121 // don't need zygote FD any more 122 // don't need zygote FD any more
122 if (IGNORE_EINTR(close(kNaClZygoteDescriptor)) != 0) 123 if (IGNORE_EINTR(close(kNaClZygoteDescriptor)) != 0)
123 LOG(ERROR) << "close(kNaClZygoteDescriptor) failed."; 124 LOG(ERROR) << "close(kNaClZygoteDescriptor) failed.";
125 if (uses_nonsfi_mode) {
126 nacl::nonsfi::InitializeSignalHandler();
127 }
124 InitializeLayerTwoSandbox(uses_nonsfi_mode); 128 InitializeLayerTwoSandbox(uses_nonsfi_mode);
125 base::GlobalDescriptors::GetInstance()->Set( 129 base::GlobalDescriptors::GetInstance()->Set(
126 kPrimaryIPCChannel, 130 kPrimaryIPCChannel,
127 child_fds[content::ZygoteForkDelegate::kBrowserFDIndex]); 131 child_fds[content::ZygoteForkDelegate::kBrowserFDIndex]);
128 132
129 base::MessageLoopForIO main_message_loop; 133 base::MessageLoopForIO main_message_loop;
130 NaClListener listener; 134 NaClListener listener;
131 listener.set_uses_nonsfi_mode(uses_nonsfi_mode); 135 listener.set_uses_nonsfi_mode(uses_nonsfi_mode);
132 listener.set_prereserved_sandbox_size(system_info.prereserved_sandbox_size); 136 listener.set_prereserved_sandbox_size(system_info.prereserved_sandbox_size);
133 listener.set_number_of_cores(system_info.number_of_cores); 137 listener.set_number_of_cores(system_info.number_of_cores);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 // Now handle requests from the Zygote. 458 // Now handle requests from the Zygote.
455 while (true) { 459 while (true) {
456 bool request_handled = HandleZygoteRequest(kNaClZygoteDescriptor, 460 bool request_handled = HandleZygoteRequest(kNaClZygoteDescriptor,
457 system_info); 461 system_info);
458 // Do not turn this into a CHECK() without thinking about robustness 462 // Do not turn this into a CHECK() without thinking about robustness
459 // against malicious IPC requests. 463 // against malicious IPC requests.
460 DCHECK(request_handled); 464 DCHECK(request_handled);
461 } 465 }
462 NOTREACHED(); 466 NOTREACHED();
463 } 467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698