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

Side by Side Diff: components/nacl/browser/nacl_process_host.cc

Issue 177113009: Support non-SFI mode in NaCl manifest file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 9 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
OLDNEW
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 "components/nacl/browser/nacl_process_host.h" 5 #include "components/nacl/browser/nacl_process_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 : socket_for_renderer(NACL_INVALID_HANDLE), 230 : socket_for_renderer(NACL_INVALID_HANDLE),
231 socket_for_sel_ldr(NACL_INVALID_HANDLE) { } 231 socket_for_sel_ldr(NACL_INVALID_HANDLE) { }
232 }; 232 };
233 233
234 // ----------------------------------------------------------------------------- 234 // -----------------------------------------------------------------------------
235 235
236 NaClProcessHost::NaClProcessHost(const GURL& manifest_url, 236 NaClProcessHost::NaClProcessHost(const GURL& manifest_url,
237 int render_view_id, 237 int render_view_id,
238 uint32 permission_bits, 238 uint32 permission_bits,
239 bool uses_irt, 239 bool uses_irt,
240 bool uses_nonsfi_mode,
240 bool enable_dyncode_syscalls, 241 bool enable_dyncode_syscalls,
241 bool enable_exception_handling, 242 bool enable_exception_handling,
242 bool enable_crash_throttling, 243 bool enable_crash_throttling,
243 bool off_the_record, 244 bool off_the_record,
244 const base::FilePath& profile_directory) 245 const base::FilePath& profile_directory)
245 : manifest_url_(manifest_url), 246 : manifest_url_(manifest_url),
246 permissions_(GetNaClPermissions(permission_bits)), 247 permissions_(GetNaClPermissions(permission_bits)),
247 #if defined(OS_WIN) 248 #if defined(OS_WIN)
248 process_launched_by_broker_(false), 249 process_launched_by_broker_(false),
249 #endif 250 #endif
250 reply_msg_(NULL), 251 reply_msg_(NULL),
251 #if defined(OS_WIN) 252 #if defined(OS_WIN)
252 debug_exception_handler_requested_(false), 253 debug_exception_handler_requested_(false),
253 #endif 254 #endif
254 internal_(new NaClInternal()), 255 internal_(new NaClInternal()),
255 weak_factory_(this), 256 weak_factory_(this),
256 uses_irt_(uses_irt), 257 uses_irt_(uses_irt),
258 uses_nonsfi_mode_(uses_nonsfi_mode),
257 enable_debug_stub_(false), 259 enable_debug_stub_(false),
258 enable_dyncode_syscalls_(enable_dyncode_syscalls), 260 enable_dyncode_syscalls_(enable_dyncode_syscalls),
259 enable_exception_handling_(enable_exception_handling), 261 enable_exception_handling_(enable_exception_handling),
260 enable_crash_throttling_(enable_crash_throttling), 262 enable_crash_throttling_(enable_crash_throttling),
261 off_the_record_(off_the_record), 263 off_the_record_(off_the_record),
262 profile_directory_(profile_directory), 264 profile_directory_(profile_directory),
263 render_view_id_(render_view_id) { 265 render_view_id_(render_view_id) {
264 process_.reset(content::BrowserChildProcessHost::Create( 266 process_.reset(content::BrowserChildProcessHost::Create(
265 PROCESS_TYPE_NACL_LOADER, this)); 267 PROCESS_TYPE_NACL_LOADER, this));
266 268
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled(); 750 params.validation_cache_enabled = nacl_browser->ValidationCacheIsEnabled();
749 params.validation_cache_key = nacl_browser->GetValidationCacheKey(); 751 params.validation_cache_key = nacl_browser->GetValidationCacheKey();
750 params.version = NaClBrowser::GetDelegate()->GetVersionString(); 752 params.version = NaClBrowser::GetDelegate()->GetVersionString();
751 params.enable_exception_handling = enable_exception_handling_; 753 params.enable_exception_handling = enable_exception_handling_;
752 params.enable_debug_stub = enable_debug_stub_ && 754 params.enable_debug_stub = enable_debug_stub_ &&
753 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_); 755 NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(manifest_url_);
754 // Enable PPAPI proxy channel creation only for renderer processes. 756 // Enable PPAPI proxy channel creation only for renderer processes.
755 params.enable_ipc_proxy = enable_ppapi_proxy(); 757 params.enable_ipc_proxy = enable_ppapi_proxy();
756 params.uses_irt = uses_irt_; 758 params.uses_irt = uses_irt_;
757 params.enable_dyncode_syscalls = enable_dyncode_syscalls_; 759 params.enable_dyncode_syscalls = enable_dyncode_syscalls_;
758 params.enable_nonsfi_mode = CommandLine::ForCurrentProcess()->HasSwitch( 760 params.uses_nonsfi_mode = uses_nonsfi_mode_;
759 switches::kEnableNaClNonSfiMode);
760 761
761 const ChildProcessData& data = process_->GetData(); 762 const ChildProcessData& data = process_->GetData();
762 if (!ShareHandleToSelLdr(data.handle, 763 if (!ShareHandleToSelLdr(data.handle,
763 internal_->socket_for_sel_ldr, true, 764 internal_->socket_for_sel_ldr, true,
764 &params.handles)) { 765 &params.handles)) {
765 return false; 766 return false;
766 } 767 }
767 768
768 if (params.uses_irt) { 769 if (params.uses_irt) {
769 base::PlatformFile irt_file = nacl_browser->IrtFile(); 770 base::PlatformFile irt_file = nacl_browser->IrtFile();
(...skipping 29 matching lines...) Expand all
799 #if defined(OS_POSIX) 800 #if defined(OS_POSIX)
800 if (params.enable_debug_stub) { 801 if (params.enable_debug_stub) {
801 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle(); 802 net::SocketDescriptor server_bound_socket = GetDebugStubSocketHandle();
802 if (server_bound_socket != net::kInvalidSocket) { 803 if (server_bound_socket != net::kInvalidSocket) {
803 params.debug_stub_server_bound_socket = 804 params.debug_stub_server_bound_socket =
804 FileDescriptor(server_bound_socket, true); 805 FileDescriptor(server_bound_socket, true);
805 } 806 }
806 } 807 }
807 #endif 808 #endif
808 809
810 if (params.uses_nonsfi_mode) {
811 #if defined(OS_LINUX)
812 const bool kNonSFIModeSupported = true;
813 #else
814 const bool kNonSFIModeSupported = false;
815 #endif
816 if (!kNonSFIModeSupported ||
817 !CommandLine::ForCurrentProcess()->HasSwitch(
818 switches::kEnableNaClNonSfiMode)) {
819 return false;
820 }
821 }
822
809 process_->Send(new NaClProcessMsg_Start(params)); 823 process_->Send(new NaClProcessMsg_Start(params));
810 824
811 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE; 825 internal_->socket_for_sel_ldr = NACL_INVALID_HANDLE;
812 return true; 826 return true;
813 } 827 }
814 828
815 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is 829 // This method is called when NaClProcessHostMsg_PpapiChannelCreated is
816 // received. 830 // received.
817 void NaClProcessHost::OnPpapiChannelsCreated( 831 void NaClProcessHost::OnPpapiChannelsCreated(
818 const IPC::ChannelHandle& browser_channel_handle, 832 const IPC::ChannelHandle& browser_channel_handle,
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 process_handle.Take(), info, 1061 process_handle.Take(), info,
1048 base::MessageLoopProxy::current(), 1062 base::MessageLoopProxy::current(),
1049 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1063 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1050 weak_factory_.GetWeakPtr())); 1064 weak_factory_.GetWeakPtr()));
1051 return true; 1065 return true;
1052 } 1066 }
1053 } 1067 }
1054 #endif 1068 #endif
1055 1069
1056 } // namespace nacl 1070 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698