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

Issue 1382713002: Creating a pexe content handler to translate and run pexes. (Closed)

Created:
5 years, 2 months ago by Sean Klein
Modified:
5 years, 1 month ago
CC:
Aaron Boodman, abarth-chromium, ben+mojo_chromium.org, darin (slow to review), gregsimon, mojo-reviews_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org
Base URL:
https://github.com/domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Creating a pexe content handler to translate and run pexes. -Creates translator and linker applications, which launch the pexe translator (pnacl-llc.nexe) and pexe loader (ld.nexe), passing a message pipe handle. -Updates IRT to include callbacks for pexe translator and pexe loader. -Creates a content handler application, which contacts the translator and loader services, communicating with them via message pipes. Uses a mojom interface to pass a message pipe to each application. -The translation process places a PEXE FILE into a temporary file, compiles that pexe into a temporary OBJECT FILE, and finally links that object file into a finalized temporary NEXE FILE. All file names are passed via message pipes, and all files are unlinked after they are opened by the final service which uses them. -Adds some .pexe.mojo files to the nacl_nonsfi_apptests. Test by running: > ./mojo/tools/mojob.py build > ./out/Debug/mojo_shell --enable-multiprocess ./out/Debug/shell_apptests.pexe.mojo BUG=https://github.com/domokit/mojo/issues/396 R=mseaborn@chromium.org, phosek@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/2ba2b8d5259f250e4f7933de76645cf5113db6c0

Patch Set 1 : Works with modified nexes doing IRT. Uses environmental variable hacks. #

Patch Set 2 : Pexe --> Nexe Translation complete without callbacks/environmental variables #

Patch Set 3 : Tests Added #

Total comments: 48

Patch Set 4 : #

Patch Set 5 : Added Mojom interface to communicate with translation nexes #

Total comments: 44

Patch Set 6 : Response to Code reviews #

Total comments: 26

Patch Set 7 : Using PathService instead of URL hacking #

Total comments: 8

Patch Set 8 : #

Total comments: 4

Patch Set 9 : #

Patch Set 10 : #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+777 lines, -45 lines) Patch
M DEPS View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M mojo/nacl/nonsfi/BUILD.gn View 1 2 3 4 5 4 chunks +9 lines, -3 lines 0 comments Download
M mojo/nacl/nonsfi/README.md View 1 2 3 4 5 2 chunks +4 lines, -6 lines 0 comments Download
M mojo/nacl/nonsfi/irt_mojo_nonsfi.h View 1 2 3 4 5 6 1 chunk +14 lines, -0 lines 0 comments Download
M mojo/nacl/nonsfi/irt_mojo_nonsfi.cc View 1 2 3 4 5 6 3 chunks +51 lines, -12 lines 0 comments Download
A mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc View 1 2 3 4 5 6 7 8 9 1 chunk +106 lines, -0 lines 2 comments Download
A mojo/nacl/nonsfi/irt_pnacl_translator_link.cc View 1 2 3 4 5 1 chunk +79 lines, -0 lines 0 comments Download
A mojo/nacl/nonsfi/irt_resource_open.cc View 1 2 3 4 5 6 7 1 chunk +38 lines, -0 lines 0 comments Download
M mojo/nacl/nonsfi/nexe_launcher_nonsfi.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M mojo/nacl/nonsfi/nexe_launcher_nonsfi.cc View 1 2 3 1 chunk +6 lines, -1 line 0 comments Download
M mojo/nacl/sfi/BUILD.gn View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M mojo/public/mojo_application.gni View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M mojo/tools/data/nacl_nonsfi_apptests View 1 2 3 4 5 1 chunk +38 lines, -4 lines 0 comments Download
M services/nacl/BUILD.gn View 1 2 3 4 5 6 3 chunks +101 lines, -14 lines 0 comments Download
M services/nacl/content_handler_main_nonsfi.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
A services/nacl/content_handler_main_nonsfi_pexe.cc View 1 2 3 4 5 6 1 chunk +153 lines, -0 lines 3 comments Download
A services/nacl/pnacl_compile.cc View 1 2 3 4 5 6 7 1 chunk +73 lines, -0 lines 0 comments Download
A services/nacl/pnacl_compile.mojom View 1 2 3 4 5 1 chunk +13 lines, -0 lines 0 comments Download
A services/nacl/pnacl_link.cc View 1 2 3 4 5 6 7 1 chunk +72 lines, -0 lines 2 comments Download
A services/nacl/pnacl_link.mojom View 1 2 3 4 5 1 chunk +13 lines, -0 lines 0 comments Download

Messages

Total messages: 45 (24 generated)
Sean Klein
Tests don't work on bots yet because "ld.nexe" and "pnacl-llc.nexe" are not available. I'll send ...
5 years, 2 months ago (2015-10-19 23:34:22 UTC) #14
Sean Klein
At phosek's suggestion, I will move the changes to "data_pipe_utils" into a separate CL.
5 years, 2 months ago (2015-10-19 23:41:33 UTC) #16
Mark Seaborn
https://codereview.chromium.org/1382713002/diff/160001/DEPS File DEPS (right): https://codereview.chromium.org/1382713002/diff/160001/DEPS#newcode33 DEPS:33: 'nacl_revision': '9c69f1fcb35b34f136da7ea7c91ceb743b9d2aaa', It's better to do rolls as a ...
5 years, 2 months ago (2015-10-20 21:32:40 UTC) #17
Mark Seaborn
Some more comments... https://codereview.chromium.org/1382713002/diff/160001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc File mojo/nacl/nonsfi/irt_mojo_nonsfi.cc (right): https://codereview.chromium.org/1382713002/diff/160001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc#newcode48 mojo/nacl/nonsfi/irt_mojo_nonsfi.cc:48: nullptr }, Can you conditionalise the ...
5 years, 2 months ago (2015-10-20 22:28:58 UTC) #18
Sean Klein
https://chromiumcodereview.appspot.com/1382713002/diff/160001/DEPS File DEPS (right): https://chromiumcodereview.appspot.com/1382713002/diff/160001/DEPS#newcode33 DEPS:33: 'nacl_revision': '9c69f1fcb35b34f136da7ea7c91ceb743b9d2aaa', On 2015/10/20 21:32:40, Mark Seaborn wrote: > ...
5 years, 2 months ago (2015-10-22 21:50:01 UTC) #20
Sean Klein
This patch expands the mojom interface and binds the MojoHandle (received by the nexes) to ...
5 years, 1 month ago (2015-10-26 22:21:52 UTC) #24
Petr Hosek
https://codereview.chromium.org/1382713002/diff/240001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc File mojo/nacl/nonsfi/irt_mojo_nonsfi.cc (left): https://codereview.chromium.org/1382713002/diff/240001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc#oldcode64 mojo/nacl/nonsfi/irt_mojo_nonsfi.cc:64: nullptr}, Could you reformat all items to be consistent? ...
5 years, 1 month ago (2015-10-27 15:07:52 UTC) #25
Mark Seaborn
https://codereview.chromium.org/1382713002/diff/240001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc File mojo/nacl/nonsfi/irt_mojo_nonsfi.cc (right): https://codereview.chromium.org/1382713002/diff/240001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc#newcode57 mojo/nacl/nonsfi/irt_mojo_nonsfi.cc:57: int not_pnacl_filter(void) { Naming nit: NotPNaClFilter(). Also can use ...
5 years, 1 month ago (2015-10-27 17:30:21 UTC) #26
Sean Klein
https://codereview.chromium.org/1382713002/diff/240001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc File mojo/nacl/nonsfi/irt_mojo_nonsfi.cc (left): https://codereview.chromium.org/1382713002/diff/240001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc#oldcode64 mojo/nacl/nonsfi/irt_mojo_nonsfi.cc:64: nullptr}, On 2015/10/27 15:07:52, Petr Hosek wrote: > Could ...
5 years, 1 month ago (2015-10-28 17:02:41 UTC) #30
Sean Klein
As a follow up -- services/nacl/pnacl_compile.cc and services/nacl/pnacl_link.cc should definitely be combined into one service, ...
5 years, 1 month ago (2015-10-28 17:13:10 UTC) #31
Mark Seaborn
LGTM https://codereview.chromium.org/1382713002/diff/320001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc File mojo/nacl/nonsfi/irt_mojo_nonsfi.cc (right): https://codereview.chromium.org/1382713002/diff/320001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc#newcode17 mojo/nacl/nonsfi/irt_mojo_nonsfi.cc:17: std::string g_base_path = ""; This is a non-POD ...
5 years, 1 month ago (2015-10-28 18:31:44 UTC) #32
Sean Klein
https://codereview.chromium.org/1382713002/diff/320001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc File mojo/nacl/nonsfi/irt_mojo_nonsfi.cc (right): https://codereview.chromium.org/1382713002/diff/320001/mojo/nacl/nonsfi/irt_mojo_nonsfi.cc#newcode17 mojo/nacl/nonsfi/irt_mojo_nonsfi.cc:17: std::string g_base_path = ""; On 2015/10/28 18:31:43, Mark Seaborn ...
5 years, 1 month ago (2015-10-28 21:40:00 UTC) #34
Mark Seaborn
LGTM https://codereview.chromium.org/1382713002/diff/360001/mojo/nacl/nonsfi/irt_resource_open.cc File mojo/nacl/nonsfi/irt_resource_open.cc (right): https://codereview.chromium.org/1382713002/diff/360001/mojo/nacl/nonsfi/irt_resource_open.cc#newcode16 mojo/nacl/nonsfi/irt_resource_open.cc:16: PathService::Get(base::DIR_MODULE, &base_path); How about returning ENOENT if this ...
5 years, 1 month ago (2015-10-28 21:53:01 UTC) #35
Sean Klein
https://codereview.chromium.org/1382713002/diff/360001/mojo/nacl/nonsfi/irt_resource_open.cc File mojo/nacl/nonsfi/irt_resource_open.cc (right): https://codereview.chromium.org/1382713002/diff/360001/mojo/nacl/nonsfi/irt_resource_open.cc#newcode16 mojo/nacl/nonsfi/irt_resource_open.cc:16: PathService::Get(base::DIR_MODULE, &base_path); On 2015/10/28 21:53:01, Mark Seaborn wrote: > ...
5 years, 1 month ago (2015-10-28 22:22:16 UTC) #36
Petr Hosek
lgtm https://codereview.chromium.org/1382713002/diff/380001/mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc File mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc (right): https://codereview.chromium.org/1382713002/diff/380001/mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc#newcode50 mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc:50: size_t buf_size = 0x100000; Shouldn't this be a ...
5 years, 1 month ago (2015-10-28 23:06:09 UTC) #37
Sean Klein
https://codereview.chromium.org/1382713002/diff/380001/mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc File mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc (right): https://codereview.chromium.org/1382713002/diff/380001/mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc#newcode50 mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc:50: size_t buf_size = 0x100000; On 2015/10/28 23:06:09, Petr Hosek ...
5 years, 1 month ago (2015-10-28 23:21:48 UTC) #38
Petr Hosek
https://codereview.chromium.org/1382713002/diff/380001/mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc File mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc (right): https://codereview.chromium.org/1382713002/diff/380001/mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc#newcode50 mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc:50: size_t buf_size = 0x100000; On 2015/10/28 23:21:48, smklein1 wrote: ...
5 years, 1 month ago (2015-10-28 23:24:00 UTC) #40
Sean Klein
https://codereview.chromium.org/1382713002/diff/380001/mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc File mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc (right): https://codereview.chromium.org/1382713002/diff/380001/mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc#newcode50 mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc:50: size_t buf_size = 0x100000; On 2015/10/28 23:24:00, Petr Hosek ...
5 years, 1 month ago (2015-10-28 23:26:35 UTC) #41
Sean Klein
Committed patchset #10 (id:420001) manually as 2ba2b8d5259f250e4f7933de76645cf5113db6c0 (presubmit successful).
5 years, 1 month ago (2015-10-28 23:38:23 UTC) #42
jamesr
Sean asked me to take a look at things that might look a bit odd ...
5 years, 1 month ago (2015-11-02 23:00:02 UTC) #44
Sean Klein
5 years, 1 month ago (2015-11-03 14:31:01 UTC) #45
Message was sent while issue was closed.
Thanks for helping me review this!

All updates are made in a new CL:
https://codereview.chromium.org/1429953003/

https://codereview.chromium.org/1382713002/diff/420001/mojo/nacl/nonsfi/irt_p...
File mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc (right):

https://codereview.chromium.org/1382713002/diff/420001/mojo/nacl/nonsfi/irt_p...
mojo/nacl/nonsfi/irt_pnacl_translator_compile.cc:58: for (;;) {
On 2015/11/02 23:00:01, jamesr wrote:
> this loop could take a long time (or forever) with no output. maybe a good
place
> to add some logging?

Done -- the presubmit will complain, though.

https://codereview.chromium.org/1382713002/diff/420001/services/nacl/content_...
File services/nacl/content_handler_main_nonsfi_pexe.cc (right):

https://codereview.chromium.org/1382713002/diff/420001/services/nacl/content_...
services/nacl/content_handler_main_nonsfi_pexe.cc:84: // Overridden from
ContentHandlerFactory::ManagedDelegate:
Fixed this incorrect comment regarding ManagedDelegate -- actually inheriting
from ContentHandlerFactory::Delegate.

https://codereview.chromium.org/1382713002/diff/420001/services/nacl/content_...
services/nacl/content_handler_main_nonsfi_pexe.cc:89: base::MessageLoop
loop(mojo::common::MessagePumpMojo::Create());
On 2015/11/02 23:00:02, jamesr wrote:
> why do you need to create another message loop? 
mojo::ApplicationRunnerChromium
> creates a mojo message pump for you:
> 
>
https://github.com/domokit/mojo/blob/master/mojo/application/application_runn...

As discussed offline, the ContentHandlerFactory is running RunApplication on a
different thread. Removing the message loop here causes the content handler to
fail on the call to "compiler_init_->PexeCompilerStart(...)".

https://codereview.chromium.org/1382713002/diff/420001/services/nacl/pnacl_li...
File services/nacl/pnacl_link.cc (right):

https://codereview.chromium.org/1382713002/diff/420001/services/nacl/pnacl_li...
services/nacl/pnacl_link.cc:69: base::AtExitManager at_exit;
On 2015/11/02 23:00:02, jamesr wrote:
> what needs a base::AtExitManager? mojo::ApplicationRunnerChromium creates a
> base::AtExitManager for you but it's at a slightly different time than this
code
> is doing. normally I'd expect a particular app to either use base and use
> mojo::ApplicationRunnerChromium or not use base concepts at all and use
> mojo::ApplicationRunner

The base::AtExitManager is needed for the call to PathService on line 26. I will
need to find a different mechanism to get the root mojo directory for Android
anyway -- something akin to calling Context::ResolveShellFileURL(""), but from a
Mojo application. Is this possible?

Powered by Google App Engine
This is Rietveld 408576698