c c implementation prototype based on firefox 3.0b2 codebase/ spidermonkey vm uses sm contexts to...

1
C Implementation Prototype based on Firefox 3.0b2 codebase/ Spidermonkey VM Uses SM contexts to manage multiple JavaScript execution contexts simultaneously No static binding between threads and script spaces “Migrating threads” enter and leave spaces based on event processing needs CPU scheduling via interpreter hook (branch callback) Implements Borrowed Virtual Time [Duda99] scheduler Includes component-based management interface and UI for user interaction/adjustment Current limitations: not parallel; Firefox components aren’t thread-safe; memory accounting not implemented C C C Fine-Grained JavaScript Execution Isolation Using Script Spaces Motivation Many emerging web/in-the-cloud applications rely on increasingly complex JavaScript components coexisting within one page: Rich Internet Application (RIA) frameworks; heavy use of JS libraries; third-party ready-to-include `widgets’ Client-side extensions (content scripts) interact with arbitrary pages Current JavaScript environments lack namespace separation, fault and resource isolation; malfunctioning or malicious components affect entire page/tab and/or browser Need for robust execution environment Multi-process browsers provide partial solution: do not provide isolation below the level of individual tabs/pages and move resource management problem to underlying OS, which often lacks information about appropriate resource management strategies Amarjyoti Deka Acision, Inc. [email protected] Gecko Layout Engine ContentM odel Rendering XM LParser EventProcessing Execution Environment JavaScript Engine Security ScriptSpace M anagem ent BVT Scheduler Netw ork Layer AsyncI/O Support DataCaching DNS/HTTP/FTP/File XPCOM NSPR XPConnect Base Infrastructure Com ponents Script Spaces Provide an abstraction for separate execution of JavaScript code components Key features: Unit of isolation Configurable namespace Separately schedulable Separate termination Separate resource accounting Shared access to DOM Backwards-compatible (within each space, a single- threaded environment; respects DOM event processing semantics) Related work: Orthogonal to work directed at improving security models or implementations (Caja, ConScript, etc.) Design alternative to multi-process model Complementary to emerging parallel browser implementations <body> <div class="SS_1“ > <inputtype="button" onclick="clickhandlerA()"value="Clickm e !"\> <divid = "A">Counter</div> </div> <div class="SS_2“ > <inputtype="button" onclick="clickhandlerB()"value="Clickm e!"\> <divid = "B">Counter</div> </div> </body> This work was partially funded by NSF CAREER Award CISE/SHF #0845830 Script Spaces/DOM Relationship: By default, each page executes within its own Script Space, but Script Spaces may also be created for portions of a page corresponding to sub trees of the DOM tree. Mash-Up Example: This iGoogle mash-up includes a CPU bound gadget (Fibonacci); using Script Spaces, the page remains responsive and other gadgets remain functional even when it is run. Script Space Manager: An extension displays existing script spaces and CPU consumption over time; users can adjust consumption of spaces or terminate them safely. Godmar Back Department of Computer Science, Virginia Tech [email protected]

Upload: sabrina-richards

Post on 04-Jan-2016

222 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: C C Implementation  Prototype based on Firefox 3.0b2 codebase/ Spidermonkey VM  Uses SM contexts to manage multiple JavaScript execution contexts simultaneously

C

Implementation Prototype based onFirefox 3.0b2 codebase/Spidermonkey VM Uses SM contexts tomanage multiple JavaScript execution contexts simultaneously No static binding between threads and script spaces “Migrating threads” enter and leave spaces based on event processing needs CPU scheduling via interpreter hook (branch callback) Implements Borrowed Virtual Time [Duda99] scheduler Includes component-based management interface and UI for user interaction/adjustment Current limitations: not parallel; Firefox components aren’t thread-safe; memory accounting not implemented

C

C

CFine-Grained JavaScript Execution Isolation Using Script Spaces

Motivation Many emerging web/in-the-cloud applications rely on increasingly complex JavaScript components coexisting within one page: Rich Internet Application (RIA) frameworks; heavy use of JS libraries; third-party ready-to-include`widgets’ Client-side extensions (content scripts)interact with arbitrary pages Current JavaScript environments lacknamespace separation, fault and resource isolation; malfunctioning or maliciouscomponents affect entire page/tab and/orbrowser Need for robust execution environment Multi-process browsers provide partial solution: do not provide isolation below the level of individual tabs/pages and move resource management problem to underlying OS, which often lacks information about appropriate resource management strategies

Amarjyoti DekaAcision, Inc.

[email protected]

C

Gecko Layout

Engine

Content Model

Rendering

XML Parser

Event Processing

ExecutionEnvironment

JavaScript Engine

Security

ScriptSpaceManagement

BVT Scheduler

NetworkLayer

Async I/O

Support

Data Caching

DNS/HTTP/FTP/File

XPCOM NSPRXPConnect

Base Infrastructure Components

Script Spaces Provide an abstraction for separate execution of JavaScript code components Key features: Unit of isolation Configurable namespace Separately schedulable Separate termination Separate resource accounting Shared access to DOM Backwards-compatible (within each space, a single-threaded environment;

respects DOM event processing semantics) Related work: Orthogonal to work directed at improving security models or

implementations (Caja, ConScript, etc.) Design alternative to multi-process model Complementary to emerging parallel browser implementations

C

<body>

<div class="SS_1“ ><input type="button" onclick="clickhandlerA()" value="Click me !" \><div id = "A" >Counter</div></div>

<div class="SS_2“ ><input type="button" onclick="clickhandlerB()" value="Click me!" \><div id = "B" >Counter</div></div>

</body>

This work was partially funded by NSF CAREER Award CISE/SHF #0845830

Script Spaces/DOM Relationship: By default, each page executes within its own Script Space, but Script Spaces may also be created for portions of a page corresponding to sub trees of the DOM tree.

Mash-Up Example: This iGoogle mash-up includes a CPU bound gadget (Fibonacci); using Script Spaces, the page remains responsive and other gadgets remain functional even when it is run.

Script Space Manager:An extension displays existing script spaces and CPU consumption over time; users can adjust consumption of spaces or terminate them safely.

Godmar BackDepartment of Computer Science, Virginia Tech

[email protected]