Recent from talks
Nothing was collected or created yet.
Google Native Client
View on Wikipedia
| Google Native Client | |
|---|---|
| Developers | Google, others |
| Initial release | 16 September 2011[1] |
| Stable release | SDK: Pepper 45 / 10 July 2015
Clients: Same as Google Chrome |
| Repository | |
| Written in | C, C++ |
| Operating system | Windows, Linux, macOS, ChromeOS |
| Platform | x86, ARM, MIPS |
| Successor | WebAssembly |
| Type | Sandbox in web browsers for native code |
| License | New BSD |
| Website | developer |
Google Native Client (NaCl) is a discontinued sandboxing technology for running either a subset of Intel x86, ARM, or MIPS native code, or a portable executable, in a sandbox. It allows safely running native code from a Chromium-based web browser, independent of the user operating system, allowing web apps to run at near-native speeds, which aligns with Google's plans for ChromeOS. It may also be used for securing browser plugins, and parts of other applications or full applications[2] such as ZeroVM.[3]
Google first demonstrated the technology on 9 December 2011 by releasing several new Chrome-only versions of games known for their rich and processor-intensive graphics, including Bastion (no longer supported on the Chrome Web Store). Later Google released Portable Native Client (PNaCl), an architecture-independent compiled ahead-of-time version of NaCl. The general concept of NaCl (running native code in web browser) has been implemented before in ActiveX, but NaCl runs content in a sandbox while ActiveX application has full access to the system (disk, memory, user-interface, registry, etc.).
Mozilla proposed asm.js as an alternative to both ActiveX and NaCl. asm.js also allows applications written in C or C++ to be compiled to run in the browser and also supports ahead-of-time compilation, but is a subset of JavaScript and hence backwards-compatible with browsers that do not support it directly.
On 12 October 2016, a comment on the Chromium issue tracker indicated that Google's Pepper and Native Client teams had been destaffed.[4] On 30 May 2017, Google announced deprecation of PNaCl in favor of WebAssembly.[5] Although initially Google planned to remove PNaCl in first quarter of 2018,[5] developers postponed the date multiple times until June 2022.[6][7]
Overview
[edit]Native Client was an open-source project developed by Google.[8] Games such as Quake,[9] XaoS, Battle for Wesnoth,[10] Doom,[11] Lara Croft and the Guardian of Light,[12] From Dust,[13] and MAME, as well as the sound processing system Csound, have been ported to Native Client. Native Client has been available in the Google Chrome web browser since version 14, and has been enabled by default since version 31, when the Portable Native Client (PNaCl, pronounced: pinnacle) was released.[14][15][16] Native Client has also been used to safely run downloaded code in software other than web browsers, like in the Dæmon game engine.[17]
An ARM implementation was released in March 2010.[18] x86-64, IA-32, and MIPS were 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.[19] The executables are called PNaCl executables (pexes). The PNaCl Toolchain makes .pexe files; NaCl Toolchain .nexe files. The magic number of .nexe files is 0x7F 'E' 'L' 'F', which is ELF. In Chrome, they are translated to architecture-specific executables so that they can be run.
NaCl uses software fault detection and isolation for sandboxing on x86-64 and ARM.[20] 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.[21] 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.[21] Because of these constraints, C and C++ code must be recompiled to run under Native Client, which provides customized versions of the GNU toolchain, specifically GNU Compiler Collection (GCC), GNU Binutils, and LLVM.
Native Client is licensed under a BSD-style license.
Native Client uses Newlib as its C library, but a port of GNU C Library (GNU libc) is also available.[22]
History
[edit]On 9 December 2011, Google demonstrated the readiness of the technology by announcing availability of several new Chrome-only versions of games known for their rich and processor-intensive graphics, including Bastion (no longer supported on the Chrome Web Store). NaCl runs hardware-accelerated 3D graphics (via OpenGL ES 2.0), sandboxed local file storage, dynamic loading, full screen mode, and mouse capture. There were also plans to make NaCl available on handheld devices.[23][24]
Portable Native Client (PNaCl) is an architecture-independent version. PNaCl apps are compiled ahead-of-time. PNaCl is recommended over NaCl for most use cases.[25] The general concept of NaCl (running native code in web browser) has been implemented before in ActiveX, which, while still in use, has full access to the system (disk, memory, user-interface, registry, etc.). Native Client avoids this issue by using sandboxing.
An alternative by Mozilla was asm.js, which also allows applications written in C or C++ to be compiled to run in the browser and also supports ahead-of-time compilation, but is a subset of JavaScript and hence backwards-compatible with browsers that do not support it directly.
On 12 October 2016, a comment on the Chromium issue tracker indicated that Google's Pepper and Native Client teams had been destaffed.[4] On 30 May 2017, Google announced deprecation of PNaCl in favor of WebAssembly.[5] Although initially Google planned to remove PNaCl in first quarter of 2018,[5] and later in the second quarter of 2019,[26] it has been removed in June 2022 (together with Chrome Apps).[6][7]
Pepper
[edit]NaCl denotes sodium chloride, common 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.[27] Pepper Plugin API, or PPAPI[28][29] is a cross-platform API for Native Client-secured web browser plugins, first based on Netscape's NPAPI, then rewritten from scratch. It was used in Chromium and Google Chrome to enable the PPAPI version of Adobe Flash[30] and the built-in PDF viewer.[31]
PPAPI
[edit]On 12 August 2009, a page on Google Code introduced a new project, Pepper, and the associated Pepper Plugin API (PPAPI),[32] "a set of modifications to NPAPI to make plugins more portable and more secure".[33] This extension is designed specifically to ease implementing 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.
- Standardize rendering using the browser's compositing process.
- Defining standardized events, and 2D rasterizing functions.
- Initial attempt to provide 3D graphics access.
- Plugin registry.
The Pepper API also supports Gamepads (version 19) and WebSockets (version 18).[34]
As of 13 May 2010[update], Google's open source browser, Chromium, was the only web browser to use the new browser plug-in model.[35] As of 2020, Pepper is supported by Chrome, Chromium and Blink layout engine-based browsers such as Opera and Microsoft Edge.
In August 2020, Google announced that support for PPAPI would be removed from Google Chrome and Chromium in June 2022.[36]
PPAPI in Firefox
[edit]Firefox developers stated in 2014 that they would not support Pepper, as there were no full specification of the API beyond its implementation in Chrome, which itself was designed for use with Blink layout engine only, and had private APIs specific to the Flash Player plugin which were not documented.[37] In October 2016, Mozilla announced that it had re-considered and was exploring whether to incorporate the Pepper API and PDFium in future releases of Firefox,[38] however no such steps were taken. In July 2017, Adobe deprecated Flash and announced its end-of-life in the end of 2020.[39] By January 2021, Adobe Flash Player, Google Chrome, Firefox, Safari, and Windows[40] received updates disabling or entirely removing Flash.
Applications
[edit]One website[41] used NaCL on the server to let users experiment with the Go programming language from their browsers.[42]
Usage outside of web browsers
[edit]The open-source Unvanquished game makes use of Native Client in the Dæmon game engine[43] in replacement of the Q3VM (Quake III virtual machine).[44][45] In such game engine, the Native Client sandbox is used to safely run arbitrary game code (mods) downloaded from game servers. Using the Native Client technology makes possible for gameplay developers to use the C++ language for games running in the virtual machine, to use C++ libraries, to share code between the game and the engine and to get better performance than with the Q3VM.[17]
Reception
[edit]Some groups of browser developers supported the Native Client technology while others did not.
Supporters
[edit]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 (besides JavaScript).[46]
Id Software's John D. 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."[47]
Detractors
[edit]Other IT professionals were more critical of this sandboxing technology as it had substantial or substantive interoperability issues.
Mozilla's vice president of products, Jay Sullivan, said that Mozilla has no plans to run 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."[48]
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.[2]
Håkon Wium Lie, Opera's CTO, believed 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."[2]
Second generation
[edit]The second generation of sandboxing developed in Google is gVisor.[49][50] It is intended to replace NaCl in Google Cloud, to be more exact in Google App Engine. Google has also been promoting WebAssembly.[51]
See also
[edit]- Application virtualization
- Emscripten
- Sandboxie, running Windows programs in a sandbox
- WebAssembly, a bytecode standard for web browsers
- XAML Browser Applications (XBAP)
References
[edit]- ^ "Google's Native Client goes live in Chrome". The Register. 16 September 2011. Retrieved 12 March 2016.
- ^ a b c Metz, Cade (12 September 2011). "Google Native Client: The web of the future – or the past?". The Register. Retrieved 17 September 2011.
- ^ "ZeroVM Architecture". Archived from the original on 8 February 2014. Retrieved 16 March 2014.
- ^ a b "Bugs.chromium.org". 12 October 2016. Retrieved 12 October 2016.
- ^ a b c d "Goodbye PNaCl, Hello WebAssembly!". Chromium Blog. Retrieved 31 May 2017.
- ^ a b "Changes to the Chrome App Support Timeline". Chromium Blog. 10 August 2020.
- ^ a b Li, Abner (10 August 2020). "Google delays deprecation of Chrome Apps on all platforms". 9to5Google. Retrieved 2 October 2021.
- ^ "Google Native Client on Google Code". Retrieved 25 April 2012.
- ^ davemichael (3 October 2020). "GitHub - davemichael/NaCl-Quake: Quake for Native Client (based on the SDL Quake port)". GitHub.
- ^ "The Battle for Wesnoth".
- ^ "Index of /". Archived from the original on 23 April 2025. Retrieved 26 November 2013.
- ^ "Chrome Web Store - Lara Croft and the Guardian of Light". Archived from the original on 8 December 2013. Retrieved 26 November 2013.
- ^ "From Dust". Archived from the original on 12 March 2016. Retrieved 24 February 2016.
- ^ Chen, Brad (8 December 2008). "Native Client: A Technology for Running Native Code on the Web". Google-code-updates.blogspot.com. Retrieved 25 April 2012.
- ^ "The Chromium Blog: Native Client Brings Sandboxed Native Code to Chrome Web Store Apps". Blog.chromium.org. 18 August 2011. Retrieved 25 April 2012.
- ^ "Google Code Blog: Portable Native Client: The "pinnacle" of speed, security, and portability". blog.chromium.org. 12 November 2013. Retrieved 16 March 2014.
- ^ a b "Unvanquished Continues Work On Its PNaCl Support". Phoronix. 15 March 2014. Retrieved 3 December 2024.
PNaCl sandboxes allow game-play developers to use modern C++ and C/C++ libraries directly within their virtual machines and will allow for better code sharing between the engine code and game logic. PNaCl is also reported to offer better performance than the original Quake III virtual machines.
- ^ "Google's Native Client goes ARM and beyond". The H. 18 March 2010. Retrieved 19 May 2010.
- ^ "PNaCl: Portable Native Client Executables" (PDF). Archived from the original (PDF) on 2 May 2012. Retrieved 25 April 2012.
- ^ Sehr, David; Muth, Robert; Biffle, Cliff L.; Khimenko, Victor; Pasko, Egor; Yee, Bennet; Schimpf, Karl; Chen, Brad (2010). "Adapting Software Fault Isolation to Contemporary CPU Architectures". 19th USENIX Security Symposium. Retrieved 31 July 2011.
- ^ a b Yee, Bennet; Sehr, David; Dardyk, Greg; Chen, Brad; Muth, Robert; Ormandy, Tavis; Okasaka, Shiki; Narula, Neha; Fullagar, Nicholas (2009). "Native Client: A Sandbox for Portable, Untrusted x86 Native Code". IEEE Symposium on Security and Privacy (Oakland'09). Retrieved 31 July 2011.
- ^ "Native Client: Building". developer.chrome.com. Archived from the original on 17 March 2014. Retrieved 16 March 2014.
- ^ Rosenblatt, Seth (9 December 2011). "Native Client turns Chrome into high-end gaming platform". CNET. Archived from the original on 28 August 2012. Retrieved 9 December 2011.
- ^ "Google Code Blog: Games, apps and runtimes come to Native Client". Googlecode.blogspot.com. 9 December 2011. Retrieved 25 April 2012.
- ^ "NaCl and PNaCl". Archived from the original on 18 November 2020. Retrieved 15 November 2015.
- ^ "WebAssembly Migration Guide - Google Chrome". developer.chrome.com. Archived from the original on 12 March 2019. Retrieved 20 December 2018.
- ^ "Technical Overview". Archived from the original on 28 February 2014.
- ^ "Pepper Plugin API project at". Archived from the original on 9 September 2016. Retrieved 25 April 2012.
- ^ "Chrome Source: Index of /trunk/src/ppapi". Src.chromium.org. Retrieved 25 April 2012.
- ^ "The road to safer, more stable, and flashier Flash". 8 August 2012. Retrieved 10 August 2013.
- ^ Metz, Cade (18 June 2010). "Google hugs Adobe harder with Chrome-PDF merge". The Register. Retrieved 25 April 2012.
- ^ "Getting Started: Background and Basics – The Chromium Projects". Chromium.org. Archived from the original on 21 December 2020. Retrieved 25 April 2012.
- ^ "Pepper.wiki". 24 February 2012. Retrieved 25 April 2012.
- ^ "Release Notes". Archived from the original on 18 November 2020. Retrieved 16 March 2014.
- ^ Metz, Cade (13 May 2010). "Google heats up native code for Chrome OS". Theregister.co.uk. Retrieved 25 April 2012.
- ^ Anthony Laforge (10 August 2020). "Changes to the Chrome App Support Timeline". Chromium Blog.
- ^ Zbarsky, Boris. "Bug 729481 - Support the "Pepper" Plugin api". Retrieved 15 April 2016.
- ^ Metz, Cade (3 October 2016). "Project Mortar". Mozilla. Retrieved 30 October 2016.
- ^ "Flash & The Future of Interactive Content". Adobe Inc. 25 July 2017. Archived from the original on 2 December 2017. Retrieved 31 July 2023.
- ^ Salter, Jim (4 May 2021). "Goodbye again, Flash—Microsoft makes removal from Windows 10 mandatory". Ars Technica. Retrieved 1 August 2023.
- ^ "The Go Playground".
- ^ "Inside the Go Playground - The Go Blog". blog.golang.org. Retrieved 27 August 2016.
- ^ Larabel, Michael (9 July 2015). "Unvanquished Alpha 41 Released, Still Moving Towards NaCl VM Usage". Phoronix. Retrieved 3 December 2024.
They've continued moving along with their open-source game and Daemon engine. […] their libRocket implementation has moved into the NaCl VM.
- ^ "Unvanquished Continues Work On Its PNaCl Support". Phoronix. 15 March 2014. Retrieved 3 December 2024.
Open-source Unvanquished developers continue working on support for using Google's Portable Native Client (PNaCl) to replace Quake III QVMs.
- ^ "Unvanquished Alpha 34 Brings Fixes, Still Being Ported To PNaCl". Phoronix. 8 December 2014. Retrieved 3 December 2024.
Under the hood, they remain hard at work on porting the game logic from QVMs to Portable Native Client (PNaCl).
- ^ 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.
- ^ Carmack, John (3 August 2012). "QuakeCon 2012". youtube.com. Retrieved 26 August 2012.
- ^ Metz, Cade (24 June 2010). "Mozilla: Our browser will not run native code". The Register. Retrieved 25 April 2012.
- ^ "Beta release of PHP 7.2 in the Google App Engine standard environment | Hacker News".
- ^ "Google/Gvisor". GitHub. 15 October 2021.
- ^ Avram, Abel (31 May 2017). "Google Is to Remove Support for PNaCl". InfoQ. Retrieved 1 August 2020.
As a replacement, Google is now pushing WebAssembly.
External links
[edit]- Official website

- "Issues - nativeclient". bugs.chromium.org. Retrieved 2 July 2022.
- Google I/O 2013 - Introduction to Portable Native Client (PNaCl) on YouTube
- Google I/O 2009 Native Code for Compute Intensive Web Apps on YouTube – Technical talk at Google I/O 2009
- A list of OSS projects ported to Native Client
- Native Client source code in Git
- Game engine-focused introduction to Native Client with a comparison between the Quake3 Virtual Machine and PNaCL
Wallez, Corentin (15 March 2014). "Moving the server-side gamelogic to PNaCl". Retrieved 3 December 2024.
Examples
[edit]- Folding@home
- PNaCl examples (runs in Chrome 31+, PNaCl, i.e. no installation needed)
- Native Client SDK Gallery
- torapp.info, vector editor, especially powerful for security printing (not PNaCl)
- NACLBox, a port of DOSBox to Native Client (PNaCl)
- SodaSynth, a synthesizer for Native Client (not PNaCl)
- Abadía del crimen, a port of the SDL version of Vigasoco (remake of La Abadía del Crimen) to Native Client (PNaCl)
- Bennugd, a port of Bennugd Videogames examples to Native Client (PNaCl)
Google Native Client
View on GrokipediaOverview and Fundamentals
Definition and Purpose
Google Native Client (NaCl) was a sandboxing technology developed by Google that enabled the execution of subsets of native code for x86, ARM, or MIPS architectures directly within web browsers.[3] It allowed developers to run compiled C and C++ code in a secure, isolated environment, independent of the underlying operating system, thereby bridging the gap between web applications and traditional native software performance.[1] The primary purpose of NaCl was to facilitate high-performance web applications, such as games, multimedia tools, and computational tasks like image processing, without requiring third-party plugins, while preserving the browser's security model through strict isolation.[2] By executing native code at near-full CPU speed, NaCl aimed to enhance web interactivity and responsiveness, enabling richer experiences that were previously limited by interpreted languages like JavaScript.[7] At a high level, NaCl worked by compiling C/C++ source code using a modified GNU toolchain into a verifiable binary format, which a browser validator then checked for safety before execution in the sandbox.[7] This process ensured that code adhered to predefined constraints, preventing unauthorized access to system resources. NaCl modules interacted with web pages via the Pepper Plugin API (PPAPI), providing a standardized interface for integration.[1] Google initially announced Native Client on December 8, 2008, as an open-source project to advance secure native code execution on the web.[2]Core Architecture
Google Native Client (NaCl) employs a modular architecture designed to execute untrusted native code within a web browser environment. At its core, the system comprises several key components that facilitate the loading, verification, and execution of compiled modules. The primary artifact is the Native Client Module, typically delivered as a Native Manifest File (NMF) with a .nmf extension, which is a JSON-formatted document specifying the locations and configurations of architecture-specific executable files.[8] These executables, known as Native Executables (NEXEs) and denoted by .nexe files, contain the compiled native code in ELF (Executable and Linkable Format) for the target platform.[7] Complementing these are the validator and the runtime service: the validator performs static analysis on the NEXE to ensure compliance with NaCl's structural constraints, while the runtime service manages the loading and execution of the validated module within the browser's process model.[8] The architecture follows a two-tier structure to isolate and manage untrusted code execution. In this setup, the untrusted native code from the NEXE runs within a dedicated sandboxed process, separate from the browser's main renderer. A browser-hosted verifier, integrated into the plugin or extension framework, preprocesses the module before execution, enforcing format and behavioral rules to maintain isolation.[7] This division allows the runtime service—often referred to as the service loader (sel_ldr)—to host the code in a controlled environment, handling resource allocation and interfacing with browser APIs without direct access to system resources.[8] The operational process begins with compilation using a modified toolchain, such as GCC for standard NaCl or LLVM for portable variants, producing either architecture-specific NEXEs or intermediate bitcode. The NMF is then embedded in the web page via an NaCl supports multiple architectures to ensure broad compatibility, including x86-32, x86-64, and ARM for direct NEXE deployment. Additionally, the portable bitcode format enables cross-platform distribution by compiling to an intermediate representation that the runtime translates on-the-fly, mitigating the need for multiple pre-built binaries.[8]Historical Development
Origins and Early Releases
Google Native Client (NaCl) originated as a research project within Google to enable web applications to leverage the full computational power of native code while preserving browser security and portability. Development was led by engineers including Matt Papakipos, focusing on sandboxing techniques for untrusted x86 code to overcome JavaScript's performance constraints in handling intensive tasks like graphics rendering or simulations.[7] The project received its first public announcement on December 8, 2008, via an official Google blog post introducing NaCl as an open-source technology for running native compiled code directly in the browser. This announcement highlighted the goal of creating richer web experiences without relying on server-side processing or less secure plugins.[2] Alongside the announcement, Google released an early open-source snapshot of NaCl, including experimental tools for compilation and runtime execution on platforms like Windows, Linux, and Mac OS X. This initial version aimed to solicit community feedback and peer review to refine the sandboxing model.[2] Early motivations for NaCl were rooted in the need for secure, high-performance web computing amid growing concerns over vulnerabilities in browser plugins such as Adobe Flash, which had exposed users to exploits due to insufficient isolation from the host system. By June 2009, Google had advanced the project sufficiently to host a security contest, confirming the robustness of its architecture before broader integration efforts.[9][10] In October 2009, NaCl was integrated as a built-in feature into the Google Chrome Developer Channel (version 4.0.220.1), providing the first browser-native support without requiring a separate plugin and setting the stage for developer experimentation. A formal alpha release followed in May 2010 with the Native Client SDK developer preview, which offered streamlined C/C++ development tools and APIs for building portable web applications.[11][12]Key Milestones and Evolutions
In August 2011, Native Client was enabled by default in the Chrome 14 beta channel, with stable integration in September 2011, allowing developers to deploy native code execution for production use without requiring user flags.[13][14] Later that year, in December 2011, support for 3D graphics via OpenGL ES 2.0 was added through Pepper interfaces, allowing for processor-intensive demos such as the port of Bastion and other games that showcased NaCl's potential for real-time rendering.[15] The following year, 2012, saw further enhancements with the maturation of the Pepper Plugin API (PPAPI), including initial stable versions that expanded NaCl's plugin ecosystem for audio, 2D graphics, and compute tasks.[16] Threading support was also introduced via PPAPI extensions, permitting multithreaded native code execution within the sandbox to handle more complex workloads efficiently. By mid-2012, these updates had solidified NaCl as a viable platform for developers seeking near-native performance in web environments. A pivotal evolution occurred in November 2013 with the launch of Portable Native Client (PNaCl), the second-generation architecture that addressed architecture-specific limitations by compiling code to portable LLVM bitcode, enabling seamless deployment across x86 and ARM platforms without recompilation.[17] Concurrently, debugging tools were enhanced in the NaCl SDK, including improved symbol loading and remote debugging capabilities that facilitated easier development and troubleshooting. PNaCl became enabled by default in Chrome 31, broadening accessibility for web applications. From 2014 to 2016, NaCl entered its peak adoption phase within Chrome, powering a range of high-profile web applications that demanded intensive computation and graphics, such as interactive simulations and geospatial tools. Deprecation signals emerged in 2017 as Google prioritized WebAssembly for future native code efforts.[18]Technical Components
Sandboxing and Security Model
Google Native Client (NaCl) implements a multi-layered sandboxing strategy to isolate untrusted native code from the host operating system and other processes. The inner sandbox employs software fault isolation (SFI) within the service runtime, using x86 segment registers like %ds and %cs for memory isolation, with the first 64KB of the address space reserved for initialization and trampolines, while enforcing strict 32-byte instruction alignment to prevent code misalignment exploits.[7][8] This SFI mechanism bans hazardous instructions, such as system calls (e.g., syscall, int), string operations, and control transfers that could enable unauthorized memory access.[7] Complementing this, the outer sandbox leverages OS-level process isolation, confining the entire renderer process—including the service runtime—within the browser's security boundaries to limit resource access and contain potential privilege escalations.[7][8] A critical component of NaCl's security is its static validation process, performed by a lightweight verifier implemented in under 600 lines of C code.[7] Before execution, the verifier disassembles the NEXE binary and checks every instruction against a predefined set of safe operations, ensuring compliance with SFI constraints like aligned loads/stores and the absence of self-modifying code or indirect branches that could lead to buffer overflows or invalid memory accesses.[7][8] This deterministic validation is designed to be fast and reliable, rejecting non-compliant modules outright without executing them, thereby blocking common exploit vectors at load time.[7] NaCl's security model guarantees that untrusted code has no direct access to the operating system, with all input/output operations routed through mediated browser APIs, such as the Pepper Plugin API (PPAPI), for controlled interactions with web content and system resources.[7][8] System calls are restricted to a minimal set of NaCl-specific syscalls handled by the service runtime, using trampolines for safe transitions between trusted and untrusted code segments, which prevents exploits from escalating privileges beyond the sandbox.[8] Despite these protections, NaCl's model has inherent limitations, as it depends on compiler-generated binaries adhering to the restricted instruction set; hand-written assembly or non-compliant toolchains could introduce unverifiable code.[7] Additionally, while effective against direct memory corruption, the sandbox remains susceptible to side-channel attacks, such as timing-based information leaks, if the host environment or browser configuration does not mitigate them adequately.[7]Pepper Plugin API (PPAPI)
The Pepper Plugin API (PPAPI) serves as the primary interface for Native Client (NaCl) modules to communicate with the host browser, enabling access to web platform features while adhering to sandbox constraints. Developed by Google, PPAPI provides a C and C++ API that allows developers to implement plugins capable of interacting with browser resources such as the Document Object Model (DOM), graphics contexts, audio systems, and input devices. This API abstracts low-level browser functionalities into structured, asynchronous calls, ensuring that NaCl code remains isolated and secure without direct system access. By design, PPAPI facilitates high-performance native code execution in web applications, supporting tasks like rendering complex visuals or processing real-time inputs without compromising browser stability.[19] PPAPI's evolution began in 2009 as an experimental extension to the Netscape Plugin API (NPAPI), aimed at modernizing plugin development for Chromium-based browsers. The initial stable integration with NaCl occurred in 2011, providing foundational support for basic input/output operations, 2D graphics, and compute tasks through a core set of interfaces. Subsequent updates in 2013 expanded these capabilities, incorporating 3D graphics acceleration via OpenGL ES bindings and audio input/output handling, which broadened PPAPI's applicability to multimedia and interactive applications. These enhancements were delivered through iterative toolchain releases, such as Pepper_31 in 2014, aligning with NaCl's growing ecosystem while maintaining backward compatibility for existing modules.[20][21] Central to PPAPI are its key interfaces, which handle essential interactions between the NaCl module and the browser. The Graphics2D interface (PP_Graphics2D) enables 2D rendering by providing a device context for drawing operations like painting pixels, paths, and text directly onto a browser-provided buffer, supporting formats such as RGBA. For advanced visuals, the Graphics3D interface (PP_Graphics3D) offers access to 3D acceleration, allowing creation of OpenGL ES contexts for shader-based rendering and texture management within the sandbox. User interactions are managed via the InputEvent interface (PP_InputEvent), which delivers events for keyboard, mouse, and wheel actions as structured objects, enabling plugins to query event details like coordinates and modifiers without polling. Resource management is facilitated by the generic PP_Resource interface, which serves as a handle for all plugin objects and supports reference counting, serialization, and asynchronous messaging to the browser proxy for operations like URL requests or file I/O. These interfaces collectively ensure efficient, secure data flow, with all communications proxied through the browser to prevent unauthorized access. In contrast to NPAPI, PPAPI is specifically optimized for NaCl's security model, emphasizing sandboxed, cross-platform operation without the vulnerabilities inherent in NPAPI's architecture. While NPAPI allowed plugins to run in-process with the renderer, exposing browsers to crashes and exploits, PPAPI enforces out-of-process execution via a dedicated plugin process, enhancing isolation and fault tolerance. Communication with JavaScript is restricted to asynchronous PostMessage mechanisms rather than direct scriptable objects, mitigating risks from untrusted code injection. This NaCl-centric design avoids NPAPI's platform-specific quirks and legacy dependencies, promoting consistent behavior across supported browsers and eliminating issues like asynchronous initialization problems common in older plugins.[8][22]Implementations and Extensions
Browser Integrations
Google Native Client (NaCl) was primarily integrated into Google Chrome, receiving native support starting with version 14 in September 2011, which allowed developers to upload and run NaCl applications via the Chrome Web Store.[23] This integration relied on the Pepper Plugin API (PPAPI) as the underlying layer for embedding NaCl modules within web pages.[1] By 2013, NaCl achieved greater stability in Chrome, with enhancements to its sandboxing and broader availability beyond initial restrictions.[24] Support in other browsers was limited and experimental. Firefox did not provide official support for NaCl or PPAPI, with only experimental plugin compatibility available early on; Pepper Flash support ended in 2015 via an NPAPI adapter, but this did not enable NaCl functionality.[25][26] Opera, as a Chromium-based browser, offered partial NaCl support via PPAPI during this period, though it remained secondary to Chrome's implementation.[1] NaCl faced significant compatibility challenges across browsers. Apple Safari and Microsoft Edge provided no official support for NaCl or PPAPI, limiting its reach to Chromium-derived environments.[27] Development and testing required Chrome-specific tools, such as the Native Client SDK, which were not portable to other platforms. Chrome began phasing out NaCl support in 2019, aligning with the rise of WebAssembly as a successor technology, with general deprecation announced in 2017.[28] Support ended on non-ChromeOS platforms by September 2023 in Chrome version 117, while ChromeOS extended legacy compatibility until version 138 in October 2025.[5][1] As of November 2025, all NaCl support, including on ChromeOS, has been fully discontinued.[1]Portable Native Client (PNaCl)
Portable Native Client (PNaCl) was launched in 2013 as the second-generation iteration of Google Native Client, designed to enable architecture-agnostic execution of native code in web browsers through an LLVM-based portable bitcode format known as .pexe files.[3] This approach allowed developers to compile C and C++ code once into a platform-independent intermediate representation, which could then be distributed and run across diverse hardware without requiring separate binaries for each architecture, such as x86 or ARM.[29] Unlike the original Native Client, which relied on ahead-of-time compilation to architecture-specific binaries, PNaCl compiles source code to a validated LLVM bitcode intermediate representation that undergoes static verification at installation time to ensure safety and compliance with constraints like a 32-bit address space and ILP32 data model.[30] This bitcode is then just-in-time (JIT) compiled on the target device within the NaCl sandbox, leveraging the browser's hardware for optimized code generation while maintaining security through software fault isolation.[31] The validation process minimizes the trusted computing base by confirming the bitcode's invariants before execution, enabling seamless adaptation to new instruction set architectures without developer intervention.[32] PNaCl significantly reduced the developer burden for multi-platform support by eliminating the need for maintaining multiple compiled binaries, streamlining testing and deployment for web applications requiring high performance, such as physics simulations or interpreters.[3] By 2014, it had been fully integrated into Chrome's Native Client software development kit (SDK) as the recommended toolchain for creating portable modules, supporting features like POSIX APIs, threading, and SIMD instructions. This integration facilitated broader adoption for web-based native code, providing near-native speed while preserving the sandboxed security model of the original NaCl architecture. PNaCl was supported in Chrome until its deprecation announced in 2017, with removal phased out starting in Q1 2018 for general use (except Chrome Apps and extensions), and Q2 2019 for web content, after which Google recommended migration to WebAssembly as the emerging standard for portable, high-performance web code.[18] The deprecation announcement highlighted WebAssembly's growing maturity and cross-browser compatibility, with PNaCl support phased out in early 2018 for general use, though extended for Chrome Apps and Extensions until later in 2019.[4]Applications and Deployments
Web-Based Use Cases
Google Native Client (NaCl) facilitated high-performance applications in web environments by allowing compiled C and C++ code to execute at near-native speeds within the browser sandbox, targeting scenarios where JavaScript's interpreted nature proved insufficient for intensive computations. Primary use cases included high-performance web games, 3D simulations, and video editors that demanded low-latency processing for real-time rendering and manipulation. For instance, NaCl enabled ports of complex titles like the award-winning role-playing game Bastion from Supergiant Games, which ran directly in Chrome without plugins, leveraging native code for enhanced graphics and gameplay fluidity.[15] In 3D simulations, NaCl powered demonstrations of advanced physics engines, such as the Bullet Physics SDK port, which achieved full-speed real-time simulations in the browser using WebGL for rendering complex interactions like collisions and dynamics. This capability extended to geospatial applications, exemplified by the 2017 web version of Google Earth, where NaCl compiled C++ code to deliver high-fidelity 3D globe rendering with native threading for smooth navigation and data processing exclusively in Chrome. Video editors and similar tools benefited from NaCl's architecture for tasks like frame-by-frame processing and effects application, outperforming JavaScript-based alternatives in computational efficiency.[33][34] A key advantage of NaCl in web contexts was its superior performance over JavaScript for CPU-intensive operations, such as physics simulations in games or rendering pipelines in 3D environments, often achieving speeds comparable to desktop applications while maintaining browser security. Developers integrated NaCl modules using the Pepper Plugin API (PPAPI) for graphics and input handling. The NaCl SDK provided essential tools for compiling source code into portable modules (.nexe or .pexe files), which were then embedded in HTML5 pages via<embed> tags, allowing seamless invocation from JavaScript for hybrid web-native experiences.[35][36]
