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

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: only run the test on x86 linux, other architectures are not supported. 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 15 matching lines...) Expand all
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/process/process_handle.h" 31 #include "base/process/process_handle.h"
32 #include "base/rand_util.h" 32 #include "base/rand_util.h"
33 #include "components/nacl/common/nacl_switches.h" 33 #include "components/nacl/common/nacl_switches.h"
34 #include "components/nacl/loader/nacl_listener.h" 34 #include "components/nacl/loader/nacl_listener.h"
35 #include "components/nacl/loader/nacl_sandbox_linux.h" 35 #include "components/nacl/loader/nacl_sandbox_linux.h"
36 #include "components/nacl/loader/nonsfi/irt_exception_handling.h"
36 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h" 37 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h"
37 #include "content/public/common/zygote_fork_delegate_linux.h" 38 #include "content/public/common/zygote_fork_delegate_linux.h"
38 #include "crypto/nss_util.h" 39 #include "crypto/nss_util.h"
39 #include "ipc/ipc_descriptors.h" 40 #include "ipc/ipc_descriptors.h"
40 #include "ipc/ipc_switches.h" 41 #include "ipc/ipc_switches.h"
41 #include "sandbox/linux/services/credentials.h" 42 #include "sandbox/linux/services/credentials.h"
42 #include "sandbox/linux/services/libc_urandom_override.h" 43 #include "sandbox/linux/services/libc_urandom_override.h"
43 #include "sandbox/linux/services/thread_helpers.h" 44 #include "sandbox/linux/services/thread_helpers.h"
44 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" 45 #include "sandbox/linux/suid/client/setuid_sandbox_client.h"
45 46
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // The child must mimic the behavior of zygote_main_linux.cc on the child 117 // The child must mimic the behavior of zygote_main_linux.cc on the child
117 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from 118 // side of the fork. See zygote_main_linux.cc:HandleForkRequest from
118 // if (!child) { 119 // if (!child) {
119 void BecomeNaClLoader(const std::vector<int>& child_fds, 120 void BecomeNaClLoader(const std::vector<int>& child_fds,
120 const NaClLoaderSystemInfo& system_info, 121 const NaClLoaderSystemInfo& system_info,
121 bool uses_nonsfi_mode) { 122 bool uses_nonsfi_mode) {
122 VLOG(1) << "NaCl loader: setting up IPC descriptor"; 123 VLOG(1) << "NaCl loader: setting up IPC descriptor";
123 // don't need zygote FD any more 124 // don't need zygote FD any more
124 if (IGNORE_EINTR(close(kNaClZygoteDescriptor)) != 0) 125 if (IGNORE_EINTR(close(kNaClZygoteDescriptor)) != 0)
125 LOG(ERROR) << "close(kNaClZygoteDescriptor) failed."; 126 LOG(ERROR) << "close(kNaClZygoteDescriptor) failed.";
127 if (uses_nonsfi_mode) {
hidehiko 2014/04/22 00:22:37 Let's drop '{}' to follow the style around here.
Junichi Uekawa 2014/04/22 04:57:01 Done.
128 nacl::nonsfi::InitializeSignalHandler();
129 }
126 InitializeLayerTwoSandbox(uses_nonsfi_mode); 130 InitializeLayerTwoSandbox(uses_nonsfi_mode);
127 base::GlobalDescriptors::GetInstance()->Set( 131 base::GlobalDescriptors::GetInstance()->Set(
128 kPrimaryIPCChannel, 132 kPrimaryIPCChannel,
129 child_fds[content::ZygoteForkDelegate::kBrowserFDIndex]); 133 child_fds[content::ZygoteForkDelegate::kBrowserFDIndex]);
130 134
131 base::MessageLoopForIO main_message_loop; 135 base::MessageLoopForIO main_message_loop;
132 NaClListener listener; 136 NaClListener listener;
133 listener.set_uses_nonsfi_mode(uses_nonsfi_mode); 137 listener.set_uses_nonsfi_mode(uses_nonsfi_mode);
134 listener.set_prereserved_sandbox_size(system_info.prereserved_sandbox_size); 138 listener.set_prereserved_sandbox_size(system_info.prereserved_sandbox_size);
135 listener.set_number_of_cores(system_info.number_of_cores); 139 listener.set_number_of_cores(system_info.number_of_cores);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // Now handle requests from the Zygote. 467 // Now handle requests from the Zygote.
464 while (true) { 468 while (true) {
465 bool request_handled = HandleZygoteRequest(kNaClZygoteDescriptor, 469 bool request_handled = HandleZygoteRequest(kNaClZygoteDescriptor,
466 system_info); 470 system_info);
467 // Do not turn this into a CHECK() without thinking about robustness 471 // Do not turn this into a CHECK() without thinking about robustness
468 // against malicious IPC requests. 472 // against malicious IPC requests.
469 DCHECK(request_handled); 473 DCHECK(request_handled);
470 } 474 }
471 NOTREACHED(); 475 NOTREACHED();
472 } 476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698