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

Unified Diff: components/nacl/loader/nacl_helper_linux.cc

Issue 1409633002: Non-SFI mode: Remove old Non-SFI code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/nacl/BUILD.gn ('k') | components/nacl/loader/nonsfi/abi_conversion.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nacl_helper_linux.cc
diff --git a/components/nacl/loader/nacl_helper_linux.cc b/components/nacl/loader/nacl_helper_linux.cc
index f81323ae49815b5110258505feb0393db7723df6..010239aaa467eb986c7d65d3b9e5eb21de9cf5d0 100644
--- a/components/nacl/loader/nacl_helper_linux.cc
+++ b/components/nacl/loader/nacl_helper_linux.cc
@@ -32,8 +32,6 @@
#include "base/process/process_handle.h"
#include "base/rand_util.h"
#include "components/nacl/common/nacl_switches.h"
-#include "components/nacl/loader/nacl_listener.h"
-#include "components/nacl/loader/nonsfi/nonsfi_listener.h"
#include "components/nacl/loader/sandbox_linux/nacl_sandbox_linux.h"
#include "content/public/common/content_descriptors.h"
#include "content/public/common/send_zygote_child_ping_linux.h"
@@ -44,10 +42,11 @@
#include "sandbox/linux/services/namespace_sandbox.h"
#if defined(OS_NACL_NONSFI)
+#include "components/nacl/loader/nonsfi/nonsfi_listener.h"
#include "native_client/src/public/nonsfi/irt_exception_handling.h"
#else
#include <link.h>
-#include "components/nacl/loader/nonsfi/irt_exception_handling.h"
+#include "components/nacl/loader/nacl_listener.h"
#endif
namespace {
@@ -57,6 +56,7 @@ struct NaClLoaderSystemInfo {
long number_of_cores;
};
+#if defined(OS_NACL_NONSFI)
// Replace |file_descriptor| with the reading end of a closed pipe.
void ReplaceFDWithDummy(int file_descriptor) {
// Make sure that file_descriptor is an open descriptor.
@@ -67,6 +67,7 @@ void ReplaceFDWithDummy(int file_descriptor) {
PCHECK(0 == IGNORE_EINTR(close(pipefd[0])));
PCHECK(0 == IGNORE_EINTR(close(pipefd[1])));
}
+#endif
// The child must mimic the behavior of zygote_main_linux.cc on the child
// side of the fork. See zygote_main_linux.cc:HandleForkRequest from
@@ -79,27 +80,27 @@ void BecomeNaClLoader(base::ScopedFD browser_fd,
VLOG(1) << "NaCl loader: setting up IPC descriptor";
// Close or shutdown IPC channels that we don't need anymore.
PCHECK(0 == IGNORE_EINTR(close(kNaClZygoteDescriptor)));
- // In Non-SFI mode, it's important to close any non-expected IPC channels.
- if (uses_nonsfi_mode) {
- // The low-level kSandboxIPCChannel is used by renderers and NaCl for
- // various operations. See the LinuxSandbox::METHOD_* methods. NaCl uses
- // LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT in SFI mode, so this
- // should only be closed in Non-SFI mode.
- // This file descriptor is insidiously used by a number of APIs. Closing it
- // could lead to difficult to debug issues. Instead of closing it, replace
- // it with a dummy.
- const int sandbox_ipc_channel =
- base::GlobalDescriptors::kBaseDescriptor + kSandboxIPCChannel;
-
- ReplaceFDWithDummy(sandbox_ipc_channel);
-
- // Install crash signal handlers before disallowing system calls.
+
#if defined(OS_NACL_NONSFI)
- nonsfi_initialize_signal_handler();
+ // In Non-SFI mode, it's important to close any non-expected IPC channels.
+ CHECK(uses_nonsfi_mode);
+ // The low-level kSandboxIPCChannel is used by renderers and NaCl for
+ // various operations. See the LinuxSandbox::METHOD_* methods. NaCl uses
+ // LinuxSandbox::METHOD_MAKE_SHARED_MEMORY_SEGMENT in SFI mode, so this
+ // should only be closed in Non-SFI mode.
+ // This file descriptor is insidiously used by a number of APIs. Closing it
+ // could lead to difficult to debug issues. Instead of closing it, replace
+ // it with a dummy.
+ const int sandbox_ipc_channel =
+ base::GlobalDescriptors::kBaseDescriptor + kSandboxIPCChannel;
+
+ ReplaceFDWithDummy(sandbox_ipc_channel);
+
+ // Install crash signal handlers before disallowing system calls.
+ nonsfi_initialize_signal_handler();
#else
- nacl::nonsfi::InitializeSignalHandler();
+ CHECK(!uses_nonsfi_mode);
#endif
- }
// Always ignore SIGPIPE, for consistency with other Chrome processes and
// because some IPC code, such as sync_socket_posix.cc, requires this.
« no previous file with comments | « components/nacl/BUILD.gn ('k') | components/nacl/loader/nonsfi/abi_conversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698