Commit 21270153 authored by mseaborn's avatar mseaborn Committed by Commit bot

NaCl: Clean up error handling during NaCl loader startup in OnStart()

If handling of NaClProcessMsg_Start fails, we want the NaCl loader
process to exit, otherwise it will potentially hang around uselessly
without being killed.

So change the error handling to exit with fatal errors instead of
returning to the message loop.

nonsfi/nonsfi_listener.cc already uses fatal errors, so no change is
required there.

BUG=496287
TEST=none

Review URL: https://codereview.chromium.org/1179523002

Cr-Commit-Position: refs/heads/master@{#333760}
parent ae0286c3
...@@ -328,8 +328,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { ...@@ -328,8 +328,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
#if defined(OS_LINUX) || defined(OS_MACOSX) #if defined(OS_LINUX) || defined(OS_MACOSX)
int urandom_fd = dup(base::GetUrandomFD()); int urandom_fd = dup(base::GetUrandomFD());
if (urandom_fd < 0) { if (urandom_fd < 0) {
LOG(ERROR) << "Failed to dup() the urandom FD"; LOG(FATAL) << "Failed to dup() the urandom FD";
return;
} }
NaClChromeMainSetUrandomFd(urandom_fd); NaClChromeMainSetUrandomFd(urandom_fd);
#endif #endif
...@@ -344,8 +343,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { ...@@ -344,8 +343,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
nap = NaClAppCreate(); nap = NaClAppCreate();
if (nap == NULL) { if (nap == NULL) {
LOG(ERROR) << "NaClAppCreate() failed"; LOG(FATAL) << "NaClAppCreate() failed";
return;
} }
IPC::ChannelHandle browser_handle; IPC::ChannelHandle browser_handle;
...@@ -383,12 +381,11 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { ...@@ -383,12 +381,11 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
ppapi_renderer_handle, ppapi_renderer_handle,
trusted_listener_->TakeClientChannelHandle(), trusted_listener_->TakeClientChannelHandle(),
manifest_service_handle))) manifest_service_handle)))
LOG(ERROR) << "Failed to send IPC channel handle to NaClProcessHost."; LOG(FATAL) << "Failed to send IPC channel handle to NaClProcessHost.";
struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate(); struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate();
if (args == NULL) { if (args == NULL) {
LOG(ERROR) << "NaClChromeMainArgsCreate() failed"; LOG(FATAL) << "NaClChromeMainArgsCreate() failed";
return;
} }
#if defined(OS_LINUX) || defined(OS_MACOSX) #if defined(OS_LINUX) || defined(OS_MACOSX)
...@@ -409,8 +406,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { ...@@ -409,8 +406,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) {
args->irt_fd = _open_osfhandle(reinterpret_cast<intptr_t>(irt_handle), args->irt_fd = _open_osfhandle(reinterpret_cast<intptr_t>(irt_handle),
_O_RDONLY | _O_BINARY); _O_RDONLY | _O_BINARY);
if (args->irt_fd < 0) { if (args->irt_fd < 0) {
LOG(ERROR) << "_open_osfhandle() failed"; LOG(FATAL) << "_open_osfhandle() failed";
return;
} }
#else #else
args->irt_fd = irt_handle; args->irt_fd = irt_handle;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment