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

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

Issue 1133303005: Non-SFI mode: Open primary IPC::Channel before seccomp-sandbox enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/nacl/loader/nonsfi/nonsfi_listener.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 8206eca99b49f6776a528c34e6f68fde83f544bf..e8ac2af77e7c4d82c884d8608a953e85a7b6b765 100644
--- a/components/nacl/loader/nacl_helper_linux.cc
+++ b/components/nacl/loader/nacl_helper_linux.cc
@@ -106,26 +106,35 @@ void BecomeNaClLoader(base::ScopedFD browser_fd,
// We do this before seccomp-bpf is initialized.
PCHECK(signal(SIGPIPE, SIG_IGN) != SIG_ERR);
+ base::GlobalDescriptors::GetInstance()->Set(kPrimaryIPCChannel,
+ browser_fd.release());
+ scoped_ptr<nacl::nonsfi::NonSfiListener> nonsfi_listener;
+ if (uses_nonsfi_mode) {
+ // NonSfiListener internally creates an IPC::Channel in CLIENT mode.
+ // Inside the creation, a socket pair is created as a dedicated pipe
Mark Seaborn 2015/05/13 17:40:58 This is working around some hackery in ipc_channel
+ // for FD passing over IPC. On nacl_helper_nonsfi, socketpair() is
+ // prohibited by seccomp-bpf sandbox enabled below. So, it is necessary
+ // to create the IPC::Channel beforehand.
+ nonsfi_listener.reset(new nacl::nonsfi::NonSfiListener);
+ }
+
// Finish layer-1 sandbox initialization and initialize the layer-2 sandbox.
CHECK(!nacl_sandbox->HasOpenDirectory());
nacl_sandbox->InitializeLayerTwoSandbox(uses_nonsfi_mode);
nacl_sandbox->SealLayerOneSandbox();
nacl_sandbox->CheckSandboxingStateWithPolicy();
- base::GlobalDescriptors::GetInstance()->Set(kPrimaryIPCChannel,
- browser_fd.release());
-
base::MessageLoopForIO main_message_loop;
#if defined(OS_NACL_NONSFI)
CHECK(uses_nonsfi_mode);
- nacl::nonsfi::NonSfiListener listener;
- listener.Listen();
+ CHECK(nonsfi_listener.get());
+ nonsfi_listener->Listen();
#else
// TODO(hidehiko): Drop Non-SFI supporting from nacl_helper after the
// nacl_helper_nonsfi switching is done.
if (uses_nonsfi_mode) {
- nacl::nonsfi::NonSfiListener listener;
- listener.Listen();
+ CHECK(nonsfi_listener.get());
+ nonsfi_listener->Listen();
} else {
NaClListener listener;
listener.set_prereserved_sandbox_size(system_info.prereserved_sandbox_size);
« no previous file with comments | « no previous file | components/nacl/loader/nonsfi/nonsfi_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698