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

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: remove whitespace Created 6 years, 7 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/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/nonsfi/irt_exception_handling.h"
35 #include "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h" 36 #include "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h"
36 #include "content/public/common/content_descriptors.h" 37 #include "content/public/common/content_descriptors.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/libc_urandom_override.h" 42 #include "sandbox/linux/services/libc_urandom_override.h"
42 43
43 namespace { 44 namespace {
44 45
(...skipping 30 matching lines...) Expand all
75 // various operations. See the LinuxSandbox::METHOD_* methods. NaCl uses 76 // various operations. See the LinuxSandbox::METHOD_* methods. NaCl uses
76 // LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT in SFI mode, so this 77 // LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT in SFI mode, so this
77 // should only be closed in Non-SFI mode. 78 // should only be closed in Non-SFI mode.
78 // This file descriptor is insidiously used by a number of APIs. Closing it 79 // This file descriptor is insidiously used by a number of APIs. Closing it
79 // could lead to difficult to debug issues. Instead of closing it, replace 80 // could lead to difficult to debug issues. Instead of closing it, replace
80 // it with a dummy. 81 // it with a dummy.
81 const int sandbox_ipc_channel = 82 const int sandbox_ipc_channel =
82 base::GlobalDescriptors::kBaseDescriptor + kSandboxIPCChannel; 83 base::GlobalDescriptors::kBaseDescriptor + kSandboxIPCChannel;
83 84
84 ReplaceFDWithDummy(sandbox_ipc_channel); 85 ReplaceFDWithDummy(sandbox_ipc_channel);
86
87 // Install crash signal handlers before disallowing system calls.
88 nacl::nonsfi::InitializeSignalHandler();
85 } 89 }
86 90
87 // Finish layer-1 sandbox initialization and initialize the layer-2 sandbox. 91 // Finish layer-1 sandbox initialization and initialize the layer-2 sandbox.
88 CHECK(!nacl_sandbox->HasOpenDirectory()); 92 CHECK(!nacl_sandbox->HasOpenDirectory());
89 nacl_sandbox->InitializeLayerTwoSandbox(uses_nonsfi_mode); 93 nacl_sandbox->InitializeLayerTwoSandbox(uses_nonsfi_mode);
90 nacl_sandbox->SealLayerOneSandbox(); 94 nacl_sandbox->SealLayerOneSandbox();
91 nacl_sandbox->CheckSandboxingStateWithPolicy(); 95 nacl_sandbox->CheckSandboxingStateWithPolicy();
92 96
93 base::GlobalDescriptors::GetInstance()->Set( 97 base::GlobalDescriptors::GetInstance()->Set(
94 kPrimaryIPCChannel, 98 kPrimaryIPCChannel,
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 // Now handle requests from the Zygote. 441 // Now handle requests from the Zygote.
438 while (true) { 442 while (true) {
439 bool request_handled = HandleZygoteRequest( 443 bool request_handled = HandleZygoteRequest(
440 kNaClZygoteDescriptor, system_info, nacl_sandbox.get()); 444 kNaClZygoteDescriptor, system_info, nacl_sandbox.get());
441 // Do not turn this into a CHECK() without thinking about robustness 445 // Do not turn this into a CHECK() without thinking about robustness
442 // against malicious IPC requests. 446 // against malicious IPC requests.
443 DCHECK(request_handled); 447 DCHECK(request_handled);
444 } 448 }
445 NOTREACHED(); 449 NOTREACHED();
446 } 450 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698