15

Is it possible to run Google NaCl outside of the browser as a process sandbox?

Richard J. Ross III
  • 55,009
  • 24
  • 135
  • 201
Rafał Sobota
  • 1,468
  • 1
  • 17
  • 32

4 Answers4

9

Yes. The standalone build of Native Client contains a program called "sel_ldr" which runs the NaCl sandbox outside of the web browser. A lot of NaCl's test suite tests NaCl by running programs under sel_ldr rather than under the browser.

Mark Seaborn
  • 1,392
  • 13
  • 11
6

The Native Client documentation is probably a good starting point for trying to figure out how everything works.

As Mark Seaborn and Bennet Yee indicate, you are probably best off looking into using sel_ldr. More details about how sel_ldr is included in "The life of sel_ldr".

I haven't personally implemented anything that uses NaCl outside of a browser, so I can't unfortunately comment on the ease of doing so.

garethm
  • 2,163
  • 17
  • 27
  • Most of the links provided here are expired. I'm interested in running native sandboxed code outside a browser and NaCl may be a perfect solution for that (or not ?). – deadalnix Jun 22 '12 at 12:43
  • @deadalnix I have updated my answer to point to current documentation. – garethm Jun 26 '12 at 04:59
4

To add to Mark's answer, take a look at the sel_universal target. There are obviously some interfaces that cannot be supported, e.g., Pepper interfaces, since such a stand-alone run doesn't involve a browser. Furthermore, the stable ABI that we support is that which is exposed by the "integrated runtime" or irt, and the irt code thunk assumes that the browser is present. a standalone use of NaCl via sel_ldr would probably have to use the syscall interface initially, until an alternate irt is written. (NB: we make no guarantees about the stability of the syscall interface.)

Bennet Yee
  • 506
  • 2
  • 6
2

You can try run.py which included in Native Client's source.

Here is an example that runs a hello world program.

make test_hello_world_nexe
python native_client/run.py out/Debug/hello_world_newlib_x64.nexe

This script can build, search and invoke sel_ldr, and pass proper arguments to it automatically.

Deqing
  • 14,098
  • 15
  • 84
  • 131