Reference Monitors Part 1: OS & SFI Greg Morrisett Cornell University, Edited by Bill Mitchell, CSUS w. permission, Spr 02.

Slides:



Advertisements
Similar presentations
Goal: Write Programs in Assembly
Advertisements

ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
Current Techniques in Language-based Security David Walker COS 597B With slides stolen from: Steve Zdancewic University of Pennsylvania.
Computer Organization and Architecture
Computer Organization and Architecture
Chapter 8: System Software Part of any computer system is the system software –This is software that supports our use of the computer –We will examine.
Chapter 6 Limited Direct Execution
Secure web browsers, malicious hardware, and hardware support for binary translation Sam King.
The Design and Implementation of a Certifying Compiler [Necula, Lee] A Certifying Compiler for Java [Necula, Lee et al] David W. Hill CSCI
CSE331: Introduction to Networks and Security Lecture 28 Fall 2002.
1  2004 Morgan Kaufmann Publishers Chapter Six. 2  2004 Morgan Kaufmann Publishers Pipelining The laundry analogy.
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 121 Today’s class Operating System Machine Level.
A Type System for Expressive Security Policies David Walker Cornell University.
CS711: Reference Monitors Part 1: OS & SFI Greg Morrisett Cornell University.
1 CSE 380 Computer Operating Systems Instructor: Insup Lee and Dianna Xu University of Pennsylvania Fall 2003 Lecture Note: Protection Mechanisms.
Early OS security Overview by: Greg Morrisett Cornell University, Edited (by permission) for CSUS CSc250 by Bill Mitchell.
Language-Based Security Reference Monitors Greg Morrisett Cornell University.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
CH12 CPU Structure and Function
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Efficient Software-Based Fault Isolation—sandboxing Presented by Carl Yao.
Computer Organization
Protection and the Kernel: Mode, Space, and Context.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Containment and Integrity for Mobile Code Security policies as types Andrew Myers Fred Schneider Department of Computer Science Cornell University.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
CS533 Concepts of Operating Systems Jonathan Walpole.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
G53SEC 1 Reference Monitors Enforcement of Access Control.
1 Memory Management Basics. 2 Program P Basic Memory Management Concepts Address spaces Physical address space — The address space supported by the hardware.
Efficient Software-Based Fault Isolation Robert Wahbe, Steven Lucco Thomas E. Anderson, Susan L. Graham J. Garrett Morris, presenter.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Next Generation ISA Itanium / IA-64. Operating Environments IA-32 Protected Mode/Real Mode/Virtual Mode - if supported by the OS IA-64 Instruction Set.
Efficient Software-Based Fault Isolation By Robert Wahbe, Steven Lucco, Thomas E. Anderson, and Susan L. Graham Presented by Pehr Collins.
Department of Computer Science and Software Engineering
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.
CSCI1600: Embedded and Real Time Software Lecture 28: Verification I Steven Reiss, Fall 2015.
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.
Efficient Software-Based Fault Isolation Authors: Robert Wahbe Steven Lucco Thomas E. Anderson Susan L. Graham Presenter: Gregory Netland.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Chapter 6 Limited Direct Execution Chien-Chung Shen CIS/UD
1 Jay Ligatti (Princeton University); joint work with: Lujo Bauer (Carnegie Mellon University), David Walker (Princeton University) Enforcing Non-safety.
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.
Introduction to Operating Systems
Memory Protection: Kernel and User Address Spaces
Mechanism: Limited Direct Execution
Introduction to Operating Systems
Memory Protection: Kernel and User Address Spaces
Memory Protection: Kernel and User Address Spaces
CSE 451: Operating Systems Autumn 2005 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Autumn 2003 Lecture 9 Memory Management
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Lecture 13 Harvard architecture Coccone OS demonstrator
CSc 453 Interpreters & Interpretation
Presentation transcript:

Reference Monitors Part 1: OS & SFI Greg Morrisett Cornell University, Edited by Bill Mitchell, CSUS w. permission, Spr 02

June 2001Lang. Based Security2 A Reference Monitor (RM) Observes the execution of a program and halts the program if it is about to violate the security policy. Common Examples that apply RM architecture: –operating system (hardware-based) –interpreters (software-based) –firewalls Claim: majority of today’s enforcement mechanisms are instances of reference monitors.

June 2001Lang. Based Security3 Reference Monitors Outline Analysis of RM power and limitations. What is a security policy? What policies can reference monitors enforce? Traditional Operating Systems. –Policies and practical issues –Hardware-enforcement of OS policies. Software-enforcement of OS policies. –Why? –Software-Based Fault Isolation –Java and CLR Stack Inspection, taken to more sophisticated level in the new Microsoft.NET CLR-compliant languages –Inlined Reference Monitors

June 2001Lang. Based Security4 Requirements for a Monitor Must have (reliable) access to information about what the program is about to do. –e.g., what instruction is it about to execute? Must have the ability to “stop” the program –can’t stop a program running on another machine that you don’t own. –really, stopping isn’t necessary, but transition to a “good” state, such as suspend/debug/… Must protect the monitor’s state and code from tampering. –key reason why a kernel’s data structures and code aren’t accessible by user code. In practice, must have low overhead.

June 2001Lang. Based Security5 What Policies are realistic ? We’ll see that under quite liberal assumptions: –there’s a nice class of policies that reference monitors can enforce (safety properties). –there are desirable policies that no reference monitor can enforce precisely. Ideal is: reject program if and only if it violates the policy Assumptions: –monitor can have access to entire state of computation. –monitor can have infinite state (by runtime mem. mgt). –but monitor can’t guess the future – the predicate it uses to determine whether to halt a program must be computable.

June 2001Lang. Based Security6 Schneider's Formalism A reference monitor only sees one execution sequence of a program. So we can only enforce policies P s.t.: (1) P(S) =  S. P (  ) where P is a predicate on individual sequences. A set of execution sequences S is a property if membership is determined solely by the sequence and not the other members in the set.

June 2001Lang. Based Security7 More Constraints on Monitors Shouldn’t be able to “see” the future. –Assumption: must make decisions in finite time. –Suppose P (  ) is true but P (  [..i] ) is false for some prefix  [..i] of . When the monitor sees  [..i] it can’t tell whether or not the execution will yield  or some other sequence, so the best it can do is rule out all sequences involving  [..i] including . So in some sense, P must be continuous: (2)  . P (  )  (  i. P (  [..i] ))

June 2001Lang. Based Security8 Safety Properties A predicate P on sets of sequences s.t. (1) P(S) =  S. P (  ) (2)  . P (  )  (  i. P (  [..i] )) is a safety property: “no bad thing will happen.” Conclusion: a reference monitor can’t enforce a policy P unless it’s a safety property. In fact, Schneider shows that reference monitors can (in theory) implement any safety property.

June 2001Lang. Based Security9 Safety vs. Security Safety is what we can implement, but is it what we want? –“lack of info. flow” isn’t a property. Safety ensures something bad won’t happen, but it doesn’t ensure something good will eventually happen: –program will terminate –program will eventually release the lock –user will eventually make payment These are examples of liveness properties. –policies involving availability aren’t safety prop. –so a ref. monitor can’t handle denial-of-service?

June 2001Lang. Based Security10 Safety Is Nice Safety does have its benefits: –They compose: if P and Q are safety properties, then P & Q is a safety property (just the intersection of allowed traces.) –Safety properties can approximate liveness by setting limits. e.g., we can determine that a program terminates within k steps. –We can also approximate many other security policies (e.g., info. flow) by simply choosing a stronger safety property.

June 2001Lang. Based Security11 Practical Issues In theory, a monitor could: –examine the entire history and the entire machine state to decide whether or not to allow a transition. –perform an arbitrary computation to decide whether or not to allow a transition. In practice, most systems: –keep a small piece of state to track history –only look at labels on the transitions –have small labels –perform simple tests Otherwise, the overheads would be overwhelming. –so policies are practically limited by the vocabulary of labels, the complexity of the tests, and the state maintained by the monitor.

June 2001Lang. Based Security12 Software Fault Isolation (SFI) Wahbe et al. (SOSP’93) Keep software components in same hardware-based address space. Use a software-based reference monitor to isolate components into logical address spaces. –conceptually: check each read, write, & jump to make sure it’s within the component’s logical address space. –hope: communication as cheap as procedure call. –worry: overheads of checking will swamp the benefits of communication. Note: doesn’t deal with other policy issues –e.g., availability of CPU

June 2001Lang. Based Security13 One Way to SFI void interp(int pc, reg[], mem[], code[], memsz, codesz) { while (true) { if (pc >= codesz) exit(1); int inst = code[pc], rd = RD(inst), rs1 = RS1(inst), rs2 = RS2(inst), immed = IMMED(inst); switch (opcode(inst)) { case ADD: reg[rd] = reg[rs1] + reg[rs2]; break; case LD: int addr = reg[rs1] + immed; if (addr >= memsz) exit(1); reg[rd] = mem[addr]; break; case JMP: pc = reg[rd]; continue;... } pc++; }} 0: add r1,r2,r3 1: ld r4,r3(12) 2: jmp r4

June 2001Lang. Based Security14 Pros & Cons of Interpreter Pros: –easy to implement (small TCB.) –works with binaries (high-level language- independent.) –easy to enforce other aspects of OS policy Cons: –terribly execution overhead (x25? x70?) but it’s a start.

June 2001Lang. Based Security15 Partial Evaluation (PE) A technique for speeding up interpreters. –we know what the code is. –specialize the interpreter to the code. unroll the loop – one copy for each instruction specialize the switch to the instruction compile the resulting code For a cool example of this, see Fred Smith's thesis (hanging off my web page.)

June 2001Lang. Based Security16 Example PE Specialized interpreter: reg[1] = reg[2] + reg[3]; addr = reg[3] + 12; if (addr >= memsz) exit(1); reg[4] = mem[addr]; pc = reg[4] 0: add r1,r2,r3 1: ld r4,r3(12) 2: jmp r4... Original Binary: while (true) { if (pc >= codesz) exit(1); int inst = code[pc];... } Interpreter 0: add r1,r2,r3 1: addi r5,r3,12 2: subi r6,r5,memsz 3: jab _exit 4: ld r4,r5(0)... Resulting Compiled Code

June 2001Lang. Based Security17 SFI in Practice Used a hand-written specializer or rewriter. –Code and data for a domain in one contiguous segment. upper bits are all the same and form a segment id. separate code space to ensure code is not modified. –Inserts code to ensure stores [optionally loads] are in the logical address space. force the upper bits in the address to be the segment id no branch penalty – just mask the address may have to re-allocate registers and adjust PC-relative offsets in code. simple analysis used to eliminate unnecessary masks –Inserts code to ensure jump is to a valid target must be in the code segment for the domain must be the beginning of the translation of a source instruction in practice, limited to instructions with labels.

June 2001Lang. Based Security18 More on Jumps PC-relative jumps are easy: –just adjust to the new instruction’s offset. Computed jumps are not: –must ensure code doesn’t jump into or around a check or else that it’s safe for code to do the jump. –for this paper, they ensured the latter: a dedicated register is used to hold the address that’s going to be written – so all writes are done using this register. only inserted code changes this value, and it’s always changed (atomically) with a value that’s in the data segment. so at all times, the address is “valid” for writing. works with little overhead for almost all computed jumps.

June 2001Lang. Based Security19 More SFI Details Protection vs. Sandboxing: –Protection is fail-stop: stronger security guarantees (e.g., reads) required 5 dedicated registers, 4 instruction sequence 20% overhead on 1993 RISC machines –Sandboxing covers only stores requires only 2 registers, 2 instruction sequence 5% overhead Remote Procedure Call: –10x cost of a procedure call –10x faster than a really good OS RPC Sequoia DB benchmarks: 2-7% overhead for SFI compared to 18-40% overhead for OS.

June 2001Lang. Based Security20 Questions What happens on the x86? –small # of registers –variable-length instruction encoding What happens with discontiguous hunks of memory? What would happen if we really didn’t trust the extension? –i.e., check the arguments to an RPC? –timeouts on upcalls? Does this really scale to secure systems?