Google Native Client

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Not to be confused with Networking and Cryptography library.
Google Native Client
Developer(s) Google, others
Stable release SDK: Pepper 33 (16 December 2013; 4 months ago (2013-12-16)), Client: 34.0.1847.116 (April 8, 2014; 14 days ago (2014-04-08)1) [±]
Development status Production (NaCl, PNaCl2)
Written in C, C++
Operating system Cross-platform: Microsoft Windows, Linux, OS X, Chrome OS
Type Sandbox in web browsers for native code
License New BSD license
Website developer.chrome.com/native-client

Google Native Client (NaCl) is a sandboxing technology for running a subset of Intel x86, ARM or MIPS native code in a sandbox. It allows safely running native code from a web browser, independent of user operating system, allowing web-based applications to run at near-native speeds,3 which aligns well with Google's plans with Chrome OS. It may also be used for securing browser plugins, as well as parts of other applications or full applications4 such as ZeroVM.5

To demonstrate the readiness of the technology, on 9 December 2011, Google announced the availability of several new Chrome-only versions of games known for their rich and processor-intensive graphics, including Bastion. NaCl runs hardware-accelerated 3D graphics (via OpenGL ES 2.0), sandboxed local file storage, dynamic loading, full screen mode, and mouse capture. There are also plans to make NaCl available on handheld devices.67

The general concept of NaCl (running native code in web browser) has been implemented before in ActiveX, which, while still in use, has a legacy of DLL hell and security problems. Native Client avoids these issues by using sandboxing. Using PNaCl, Native Client is also architecture-independent, like Java. Unlike Java, PNaCl apps are compiled ahead-of-time in the browser, and not just-in-time. This can make performance more predictable.

Overview

Native Client is an open-source project being developed by Google.8 To date, Quake,9 XaoS, Battle for Wesnoth,10 Doom,11 Lara Croft and the Guardian of Light12 and MAME, as well as the sound processing system Csound, have been ported to Native Client. Native Client has been available as an experimental disabled-by-default feature in the Google Chrome web browser since version 14.3 Chrome previously required Native Client to be enabled in chrome://flags to run from any web site.13 With the release of Portable Native Client (PNaCl, pronounced: pinnacle) in Chrome 31,14 Chrome enabled it for all pages and web apps by default, including those distributed outside the Chrome Web Store.15

An ARM implementation was released in March 2010.16 x86-64, IA-32 and MIPS are also supported.

To run an application portably under PNaCl, it must be compiled to an architecture-agnostic and stable subset of the LLVM intermediate representation bytecode.17 The executables are called PNaCl executables (pexes). In Chrome, they are translated to architecture-specific executables so that they can be run.

NaCl uses software fault isolation for sandboxing on x86-64 and ARM.18 The x86-32 implementation of Native Client is notable for its novel sandboxing method which makes use of the x86 architecture's rarely-used segmentation facility.19 Native Client sets up x86 segments to restrict the memory range that the sandboxed code can access. It uses a code verifier to prevent use of unsafe instructions such as those that perform system calls. To prevent the code from jumping to an unsafe instruction hidden in the middle of a safe instruction, Native Client requires that all indirect jumps be jumps to the start of 32-byte-aligned blocks, and instructions are not allowed to straddle these blocks.19 Because of these constraints, C/C++ code must be recompiled to run under Native Client, which provides customized versions of the GNU toolchain, specifically GCC and binutils as well as LLVM.

Native Client is licensed under a BSD-style license.

Native Client uses Newlib as its C library, but a port of GNU libc is also available.20

Pepper

NaCl denotes table salt; as a pun, the name of pepper was also used. Pepper API is a cross-platform, open-source API for creating Native Client modules.21 Pepper Plugin API, or PPAPI2223 is a cross-platform API for Native Client-secured web browser plugins, first based on Netscape's NPAPI, then rewritten from scratch. It is currently used in Chromium and Google Chrome to enable the PPAPI version of Flash24 and the built-in PDF viewer.25

PPAPI

On 12 August 2009 a page on Google Code introduced a new project, Pepper with associated Pepper Plugin API (PPAPI),26 "a set of modifications to NPAPI to make plugins more portable and more secure".27 This extension is designed specifically to ease the implementation of out-of-process plugin execution. Further, the goals of the project are to provide a framework for making plugins fully cross-platform. Topics considered include:

  • Uniform semantics for NPAPI across browsers.
  • Execution in a separate process from the renderer/browser itself.
  • Standardize rendering using the browser's compositing process.
  • Defining standardized events, and 2D rasterization functions.
  • Initial attempt at providing 3D graphics access.
  • Plugin registry.

The continuously evolving Pepper API also supports Gamepads (version 19) and WebSockets (version 18).28

As of 13 May 2010, Google's open source browser, Chromium, was the only web browser to utilize the new browser plug-in model.29 Mozilla has announced that they are "not interested in or working on Pepper at this time."30

Reception

Some groups of browser developers support the Native Client technology, but others do not.

Supporters: Chad Austin (of IMVU) praised the way Native Client can bring high-performance applications to the web (with about 5% penalty compared to native code) in a secure way, while also accelerating the evolution of client-side applications by giving a choice of the programming language used (beside JavaScript).31

Id Software's John Carmack praised Native Client at QuakeCon 2012, saying: "if you have to do something inside a browser, Native Client is much more interesting as something that started out as a really pretty darn clever x86 hack in the way that they could sandbox all of this in user mode interestingly. It's now dynamic recompilation, but something that you program in C or C++ and it compiles down to something that's going to be not your -O4 optimization level for completely native code but pretty damn close to native code. You could do all of your evil pointer chasings, and whatever you want to do as a to-the-metal game developer."32

Detractors: Other IT professionals are more critical of this sandboxing technology as it has substantial or substantive interoperability issues.

Mozilla's vice president of products, Jay Sullivan, said that Mozilla has no intention of running native code inside the browser, as "These native apps are just little black boxes in a webpage. [...] We really believe in HTML, and this is where we want to focus."33

Mozilla's Christopher Blizzard criticized NaCl, claiming that native code cannot evolve in the same way that the source code-driven web can. He also compared NaCl to Microsoft's ActiveX technology, plagued with DLL hell.4

Håkon Wium Lie, Opera's CTO, believes that "NaCl seems to be 'yearning for the bad old days, before the web'", and that "Native Client is about building a new platform – or porting an old platform into the web [...] it will bring in complexity and security issues, and it will take away focus from the web platform."4

See also

  • Sandboxie, running Windows programs in a sandbox

References

  1. ^ "Stable Channel Update". Chrome Releases. Blogger. April 8, 2014. Retrieved April 8, 2014. 
  2. ^ Chrome Revision 213999
  3. ^ a b Marchak, Mike (8 December 2008). "Native Client: A Technology for Running Native Code on the Web". Google-code-updates.blogspot.com. Retrieved 25 April 2012. 
  4. ^ a b c Cade Metz (12 September 2011). "Google Native Client: The web of the future – or the past?". The Register. Retrieved 17 September 2011. 
  5. ^ "ZeroVM Architecture". Retrieved 16 March 2014. 
  6. ^ Seth Rosenblatt (9 December 2011). "Native Client turns Chrome into high-end gaming platform". CNET. Retrieved 9 December 2011. 
  7. ^ "Google Code Blog: Games, apps and runtimes come to Native Client". Googlecode.blogspot.com. 9 December 2011. Retrieved 25 April 2012. 
  8. ^ "Google Native Client on Google Code". Google. Retrieved 25 April 2012. 
  9. ^ https://github.com/davemichael/NaCl-Quake
  10. ^ https://chrome.google.com/webstore/detail/the-battle-for-wesnoth/pobnonecghmlpppkkjpdiiblmakhhldb
  11. ^ http://doom.pdox.net
  12. ^ https://chrome.google.com/webstore/detail/lara-croft-and-the-guardi/dcfdbmpeeihbpddkneaploeinlbaaodn
  13. ^ "The Chromium Blog: Native Client Brings Sandboxed Native Code to Chrome Web Store Apps". Blog.chromium.org. 18 August 2011. Retrieved 25 April 2012. 
  14. ^ "Google Code Blog: Portable Native Client: The "pinnacle" of speed, security, and portability". blog.chromium.org. 12 November 2013. Retrieved 16 March 2014. 
  15. ^ "Distributing Your Application". developer.chrome.com. 
  16. ^ "Google's Native Client goes ARM and beyond". The H. 18 March 2010. Retrieved 19 May 2010. 
  17. ^ "PNaCl: Portable Native Client Executables" (PDF). Retrieved 25 April 2012. 
  18. ^ David Sehr, Robert Muth, Cliff L. Biffle, Victor Khimenko, Egor Pasko, Bennet Yee, Karl Schimpf, Brad Chen (2010). "Adapting Software Fault Isolation to Contemporary CPU Architectures". 19th USENIX Security Symposium. Retrieved 31 July 2011. 
  19. ^ a b Bennet Yee, David Sehr, Greg Dardyk, Brad Chen, Robert Muth, Tavis Ormandy, Shiki Okasaka, Neha Narula, Nicholas Fullagar (2009). "Native Client: A Sandbox for Portable, Untrusted x86 Native Code". IEEE Symposium on Security and Privacy (Oakland'09). Retrieved 31 July 2011. 
  20. ^ "Native Client: Building". developer.chrome.com. Retrieved 16 March 2014. 
  21. ^ Native Client: Technical Overview
  22. ^ "Pepper Plugin API project at". Google. Retrieved 25 April 2012. 
  23. ^ "Chrome Source: Index of /trunk/src/ppapi". Src.chromium.org. Retrieved 25 April 2012. 
  24. ^ "The road to safer, more stable, and flashier Flash". Google. 8 August 2012. Retrieved 10 August 2013. 
  25. ^ Metz, Cade (18 June 2010). "Google hugs Adobe harder with Chrome-PDF merge". The Register. Retrieved 25 April 2012. 
  26. ^ "Getting Started: Background and Basics – The Chromium Projects". Chromium.org. Retrieved 25 April 2012. 
  27. ^ Comment by t.hajdu....@gmail.com (24 February 2012). "Pepper.wiki". Google. Retrieved 25 April 2012. 
  28. ^ Native Client: News & Announcements
  29. ^ Metz, Cade (13 May 2010). "Google heats up native code for Chrome OS". Theregister.co.uk. Retrieved 25 April 2012. 
  30. ^ "NPAPI:Pepper – MozillaWiki". Wiki.mozilla.org. 26 May 2011. Retrieved 25 April 2012. 
  31. ^ Austin, Chad (8 January 2011). "Chad Austin: In Defense of Language Democracy (Or: Why the Browser Needs a Virtual Machine)". Chadaustin.me. Retrieved 25 April 2012. 
  32. ^ Carmack, John (3 August 2012). "QuakeCon 2012". youtube.com. Retrieved 26 August 2012. 
  33. ^ Metz, Cade (24 June 2010). "Mozilla: Our browser will not run native code". The Register. Retrieved 25 April 2012. 

External links

Examples








Creative Commons License