Efficient Software-Based Fault Isolation—sandboxing Presented by Carl Yao.

Slides:



Advertisements
Similar presentations
Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Advertisements

Lecture 16 Buffer Overflow modified from slides of Lawrie Brown.
OS Fall’02 Virtual Memory Operating Systems Fall 2002.
4/14/2017 Discussed Earlier segmentation - the process address space is divided into logical pieces called segments. The following are the example of types.
EXTENSIBILITY, SAFETY AND PERFORMANCE IN THE SPIN OPERATING SYSTEM B. Bershad, S. Savage, P. Pardyak, E. G. Sirer, D. Becker, M. Fiuczynski, C. Chambers,
Memory Management Questions answered in this lecture: How do processes share memory? What is static relocation? What is dynamic relocation? What is segmentation?
Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented by Alana Sweat.
“Efficient Software-Based Fault Isolation” (1993) by: Robert Wahbe, Steven Lucco, Thomas E. Anderson, Susan L. Graham PRESENTED BY DAVID KENNEDY.
OS Spring’03 Introduction Operating Systems Spring 2003.
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
1 Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska and Henry M. Levy Presented by: Karthika Kothapally.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Secure Embedded Processing through Hardware-assisted Run-time Monitoring Zubin Kumar.
System Calls 1.
Protection and the Kernel: Mode, Space, and Context.
Secure Execution of Untrusted Code
1 Memory Management Memory Management COSC513 – Spring 2004 Student Name: Nan Qiao Student ID#: Professor: Dr. Morteza Anvari.
Eric Keller, Evan Green Princeton University PRESTO /22/08 Virtualizing the Data Plane Through Source Code Merging.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
CS 153 Design of Operating Systems Spring 2015 Lecture 17: Paging.
CS533 Concepts of Operating Systems Jonathan Walpole.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-8 Memory Management (2) Department of Computer Science and Software.
VIRTUAL MEMORY By Thi Nguyen. Motivation  In early time, the main memory was not large enough to store and execute complex program as higher level languages.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
CE Operating Systems Lecture 14 Memory management.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
Efficient Software-Based Fault Isolation Robert Wahbe, Steven Lucco Thomas E. Anderson, Susan L. Graham J. Garrett Morris, presenter.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
1 Lecture 16: Virtual Memory Topics: virtual memory, improving TLB performance (Sections )
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Efficient Software-Based Fault Isolation By Robert Wahbe, Steven Lucco, Thomas E. Anderson, and Susan L. Graham Presented by Pehr Collins.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Processes and Virtual Memory
Efficient Software Based Fault Isolation Author: Robert Wahobe,Steven Lucco,Thomas E Anderson, Susan L Graham Presenter: Maitree kanungo Date:02/17/2010.
Efficient Software-based Fault Isolation Robert Wahbe, Steven Lucco, Thomas E. Anderson & Susan L. Graham Presented By Tony Bock.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 "Efficient Software-based Fault Isolation" by R. Wahbe, S. Lucco, T. E. Anderson, and S. L. Graham. Presenter: Tom Burkleaux.
Efficient Software-Based Fault Isolation Robert Wahbe, Steven Lucco, Thomas E. Anderson, Susan L. Graham.
Efficient software-based fault isolation Robert Wahbe, Steven Lucco, Thomas Anderson & Susan Graham Presented by: Stelian Coros.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Efficient Software-Based Fault Isolation Authors: Robert Wahbe Steven Lucco Thomas E. Anderson Susan L. Graham Presenter: Gregory Netland.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
Computer Security: Chapter 5 Operating Systems Security.
Memory Protection: Kernel and User Address Spaces Andy Wang Operating Systems COP 4610 / CGS 5765.
Efficient Software-Based Fault Isolation
Modularity Most useful abstractions an OS wants to offer can’t be directly realized by hardware Modularity is one technique the OS uses to provide better.
Memory Management.
Non Contiguous Memory Allocation
Segmentation COMP 755.
Memory Protection: Kernel and User Address Spaces
CSE 120 Principles of Operating
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
Lecture 14 Virtual Memory and the Alpha Memory Hierarchy
CMSC 611: Advanced Computer Architecture
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Memory Management Tasks
Architectural Support for OS
Operating Systems Lecture 3.
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Lecture 7: Flexible Address Translation
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
System calls….. C-program->POSIX call
CS703 - Advanced Operating Systems
Memory Protection: Kernel and User Address Spaces
CSE 542: Operating Systems
Presentation transcript:

Efficient Software-Based Fault Isolation—sandboxing Presented by Carl Yao

Revisit last week’s questions What is the motivation for modular operating system? Extensibility (Vendors have freedom to enhance parts of OS) What is the motivation for using hardware protection at module boundaries? Fault isolation (Extension modules can render OS unreliable) As a result of hardware protection, why does performance of modular systems degrade? RPC cost Purpose of sandboxing: Realizing fault isolation without the high cost of RPC

Different approaches to reduce cost of RPC LRPC—same thread runs in both caller and callee domain; less data copying compared to RPC; but still has context switch cost (sandboxing eliminates context switch cost) Tags—allows multiple address spaces to share the TLB; but relies on specialized architecture, does not reduce cost of register management or system calls (sandboxing has little of these cost)

Different approaches to realize fault isolation Restrictive programming languages (Pilot)— eliminates possible faults, thus no need for fault isolation; but no other languages can be used in these systems (sandboxing is supposed to be language-independent) Interpreter—filters faults in a programming language for OS; but again is language-dependent and has high filtering cost (sandboxing does not have high filtering cost, but it does have a 4% encapsulation cost)

What is sandboxing? An assembly-language-level software approach to implement fault isolation within a single address space Load the code and data for a distrusted module into its own fault domain, a contiguous region of memory within the application’s address space. It has a unique identifier which is used to control its access to process resources such as file descriptors. Modify the object code of a distrusted module to prevent it from writing or jumping to an address outside its fault domain. An cross-fault-domain RPC interface (much cheaper than RPC) is used for inter-fault-domain communications.

What is a fault domain? An application’s virtual address space is divided into segments, aligned so that all virtual addresses within a segment share a unique pattern of upper bits, called the segment identifier. A fault domain consists of two segments, one for a distrusted module’s code, the other for its static data, heap and stack. Example: If 101 is the segment identifier, then is inside this segment, but is not. Next we’ll talk about segment matching.

Statically verifying jump and store instructions Say we have an instruction: store value, register A If the value of register A can be verified by the compiler, then we can statically verify whether this memory address is inside or outside a certain segment. However, if the value of register A cannot be determined until run time, for example, by a user input, then we cannot statically verify whether this instruction is safe.

What is segment matching? Some instructions jump to or store to an address which cannot be statically verified. This is unsafe because it could corrupt critical data. One approach to prevent this is to insert checking code before every unsafe instruction. The checking code determines whether the unsafe instruction’s target address has the correct segment identifier or not. See next page for example.

Example of segment matching dedicated-reg = dedicated-reg>>shift-reg = 100, so scratch-reg = 100 segment-reg=101; scratch-reg=100; not equal! A trap is generated to trigger a system error routine outside the distrusted module’s fault domain. If they match, then we know the target address is indeed inside the same segment, so we can run: store value, dedicated-reg Say an unsafe instruction is located in segment 101, but wants to write to segment 100. Initially, target address= ; segment-reg=101; shift-reg=5 (or 1001);

Why use dedicated registers? Why not simply: scratch-reg >shift-reg) compare scratch-reg and segment-reg trap if not equal store value, target address Because an instruction can jump to the last instruction to bypass the checking instructions. Using dedicated registers prevent this from happening.

What is sandboxing? Segment matching can pinpoint the offending instruction. Sandboxing reduces runtime overhead further, at the cost of providing no info about the source of faults. See next page for an example.

Example of sandboxing target-reg&and-mask-reg = so dedicated-reg= segment-reg | dedicated-reg = so dedicated-reg = store value, dedicated-reg Now instead of writing to the intended unsafe location , sandboxing changed the target address to , which is in the same fault domain of the writing instruction. In this case probably this fault domain will be corrupt, but it does not affect other fault domains. Again say an unsafe instruction is located in segment 101, but wants to write to segment 100. Initially, target-reg= ; segment-reg=101; and-mask-reg= ;

Guard Zone Optimization RISC architectures include a register-plus- offset instruction mode. Consider instruction “store value, offset(reg)”. To avoid calculating reg+offset, we directly sandbox the reg, at the cost of creating guard zones at the top and bottom of each segment.

Optimizing stack pointer sandboxing The stack pointer in a segment is much more often read than set. So the MIPS stack pointer is treated as a dedicated register. The stack pointer is only sandboxed when it is set, saving the sandboxing cost when it is read. We can avoid sandboxing the stack pointer after it is modified by a small constant offset as long as the modified stack pointer is used as part of a load or store address before the next control transfer instruction.

Preventing one fault domain from corrupting another in the same address space Solution 1: Modifying the OS to know about fault domains. This will render sandboxing not portable, and thus not used. Solution 2: Distrusted modules must access system resources only through cross-fault-domain RPC. A fault domain is reserved to hold trusted arbitration code. This fault domain is used as a proxy for all fault domains in that address space when system calls are made.

Sharing data among fault domains— Lazy Pointer Swizzling A technique to share data among fault domains in the same address space with no additional runtime overhead Hardware page tables are modified to map the shared memory regions into every segment at the same offset. (aliasing) When one segment make changes to the shared data, all segments immediately see the changes because the data is aliased.

Implementing software encapsulation The authors have not developed a tool to encapsulate object code to implement sandboxing. So instead they modified gcc compiler, which made sandboxing language-dependent by the time this paper was finished. A program is broken into unsafe regions. When the program exits an unsafe region, the compiler verifies that any dedicated register modified in this region is valid. If not, the code is rejected.

Low-cost cross fault domain communication The only way for control to escape a fault domain is via a jump table, which guarantees that target addresses are legal entry point. A call-stub and a return-stub are created for each pair of fault domains. Parameters are copied from caller stub to the callee stub, then read by the callee. The stub is also responsible for managing machine states and registers. Fatal errors are handled by UNIX signal facility.

Performance lab test result Sandboxing lowers RPC cost by more than an order of magnitude. Sandboxing incurs an average of 4% execution time overhead on a DECstation 5000/240 and a DEC Alpha 400.

Performance lab test result Combining the time saved and incurred, here is the result from running an application on POSTGRES database system

Summary Sandboxing is a tradeoff between RPC cost and code execution cost. But because normal programs have a large amount of inter-process communications, sandboxing is the better option in most cases. Sandboxing is a tradeoff between level of trust and encapsulation overhead.