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

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

Issue 216603002: Tell nacl_helper to use non SFI mode in HandleForkRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/nacl/common/nacl_types.cc ('k') | components/nacl/loader/nacl_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 c8139bf25ecaa557b0627d5179e7a696ad58bcf1..8b9724335fbe51e189cf00ab7d6cb1b13f1b032f 100644
--- a/components/nacl/loader/nacl_helper_linux.cc
+++ b/components/nacl/loader/nacl_helper_linux.cc
@@ -47,7 +47,8 @@ struct NaClLoaderSystemInfo {
// side of the fork. See zygote_main_linux.cc:HandleForkRequest from
// if (!child) {
void BecomeNaClLoader(const std::vector<int>& child_fds,
- const NaClLoaderSystemInfo& system_info) {
+ const NaClLoaderSystemInfo& system_info,
+ bool uses_nonsfi_mode) {
VLOG(1) << "NaCl loader: setting up IPC descriptor";
// don't need zygote FD any more
if (IGNORE_EINTR(close(kNaClZygoteDescriptor)) != 0)
@@ -63,6 +64,7 @@ void BecomeNaClLoader(const std::vector<int>& child_fds,
base::MessageLoopForIO main_message_loop;
NaClListener listener;
+ listener.set_uses_nonsfi_mode(uses_nonsfi_mode);
listener.set_prereserved_sandbox_size(system_info.prereserved_sandbox_size);
listener.set_number_of_cores(system_info.number_of_cores);
listener.Listen();
@@ -71,7 +73,8 @@ void BecomeNaClLoader(const std::vector<int>& child_fds,
// Start the NaCl loader in a child created by the NaCl loader Zygote.
void ChildNaClLoaderInit(const std::vector<int>& child_fds,
- const NaClLoaderSystemInfo& system_info) {
+ const NaClLoaderSystemInfo& system_info,
+ bool uses_nonsfi_mode) {
const int parent_fd = child_fds[content::ZygoteForkDelegate::kParentFDIndex];
const int dummy_fd = child_fds[content::ZygoteForkDelegate::kDummyFDIndex];
bool validack = false;
@@ -103,7 +106,7 @@ void ChildNaClLoaderInit(const std::vector<int>& child_fds,
if (IGNORE_EINTR(close(parent_fd)) != 0)
LOG(ERROR) << "close(parent_fd) failed";
if (validack) {
- BecomeNaClLoader(child_fds, system_info);
+ BecomeNaClLoader(child_fds, system_info, uses_nonsfi_mode);
} else {
LOG(ERROR) << "Failed to synch with zygote";
}
@@ -115,7 +118,14 @@ void ChildNaClLoaderInit(const std::vector<int>& child_fds,
// content/browser/zygote_main_linux.cc:ForkWithRealPid()
bool HandleForkRequest(const std::vector<int>& child_fds,
const NaClLoaderSystemInfo& system_info,
+ PickleIterator* input_iter,
Pickle* output_pickle) {
+ bool uses_nonsfi_mode;
+ if (!input_iter->ReadBool(&uses_nonsfi_mode)) {
+ LOG(ERROR) << "Could not read uses_nonsfi_mode status";
+ return false;
+ }
+
if (content::ZygoteForkDelegate::kNumPassedFDs != child_fds.size()) {
LOG(ERROR) << "nacl_helper: unexpected number of fds, got "
<< child_fds.size();
@@ -129,7 +139,7 @@ bool HandleForkRequest(const std::vector<int>& child_fds,
}
if (child_pid == 0) {
- ChildNaClLoaderInit(child_fds, system_info);
+ ChildNaClLoaderInit(child_fds, system_info, uses_nonsfi_mode);
NOTREACHED();
}
@@ -201,7 +211,7 @@ bool HonorRequestAndReply(int reply_fd,
switch (command_type) {
case nacl::kNaClForkRequest:
have_to_reply = HandleForkRequest(attached_fds, system_info,
- &write_pickle);
+ input_iter, &write_pickle);
break;
case nacl::kNaClGetTerminationStatusRequest:
have_to_reply =
« no previous file with comments | « components/nacl/common/nacl_types.cc ('k') | components/nacl/loader/nacl_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698