Formally Verified Operating Systems SINGULARITY AND SEL4.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Automated and Modular Refinement Reasoning for Concurrent Programs Collaborators: Chris Hawblitzel (Microsoft) Erez Petrank (Technion) Serdar Tasiran (Koc.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 19: Minding Ps & Qs: Axiomatic.
The Design and Implementation of a Certifying Compiler [Necula, Lee] A Certifying Compiler for Java [Necula, Lee et al] David W. Hill CSCI
Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented by Alana Sweat.
The Future of Correct Software George Necula. 2 Software Correctness is Important ► Where there is software, there are bugs ► It is estimated that software.
CMSC 414 Computer and Network Security Lecture 24 Jonathan Katz.
Extensible Kernels Edgar Velázquez-Armendáriz September 24 th 2009.
CS 584. A Parallel Programming Model We need abstractions to make it simple. The programming model needs to fit our parallel machine model. Abstractions.
Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
Extensibility, Safety and Performance in the SPIN Operating System Bershad et al Presentation by norm Slides shamelessly “borrowed” from Stefan Savage’s.
Improving IPC by Kernel Design Jochen Liedtke Proceeding of the 14 th ACM Symposium on Operating Systems Principles Asheville, North Carolina 1993.
Improving IPC by Kernel Design Jochen Liedtke Shane Matthews Portland State University.
Software Reliability Methods Sorin Lerner. Software reliability methods: issues What are the issues?
A Type System for Expressive Security Policies David Walker Cornell University.
Figure 1.1 Interaction between applications and the operating system.
From last time S1: l := new Cons p := l S2: t := new Cons *p := t p := t l p S1 l p tS2 l p S1 t S2 l t S1 p S2 l t S1 p S2 l t S1 p L2 l t S1 p S2 l t.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
Cormac Flanagan University of California, Santa Cruz Hybrid Type Checking.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
Stack Management Each process/thread has two stacks  Kernel stack  User stack Stack pointer changes when exiting/entering the kernel Q: Why is this necessary?
EECS 262a Advanced Topics in Computer Systems Lecture 26 seL4 Kernel verification December 3rd, 2014 John Kubiatowicz Electrical Engineering and Computer.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Computer Science and Engineering Computer System Security CSE 5339/7339 Session 20 October 28, 2004.
© 2009 Matthew J. Sottile, Timothy G. Mattson, and Craig E Rasmussen 1 Concurrency in Programming Languages Matthew J. Sottile Timothy G. Mattson Craig.
Paper by Engler, Kaashoek, O’Toole Presentation by Charles Haiber.
Cs3102: Theory of Computation Class 18: Proving Undecidability Spring 2010 University of Virginia David Evans.
Introduction and Overview Questions answered in this lecture: What is an operating system? How have operating systems evolved? Why study operating systems?
Presentation of Singularity OS Seminar, winter 2005 by Jacob Munk-Stander November 23 rd, 2005.
Chapter 2: Operating-System Structures. 2.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 14, 2005 Operating System.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
SWE 619 © Paul Ammann Procedural Abstraction and Design by Contract Paul Ammann Information & Software Engineering SWE 619 Software Construction cs.gmu.edu/~pammann/
Proof-Carrying Code & Proof-Carrying Authentication Stuart Pickard CSCI 297 June 2, 2005.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
MIDORI The Post Windows Operating System Microsoft Research’s.
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
A Certifying Compiler and Pointer Logic Zhaopeng Li Software Security Lab. Department of Computer Science and Technology, University of Science and Technology.
Writing Systems Software in a Functional Language An Experience Report Iavor Diatchki, Thomas Hallgren, Mark Jones, Rebekah Leslie, Andrew Tolmach.
Processes Introduction to Operating Systems: Module 3.
COP4020 Programming Languages Introduction to Axiomatic Semantics Prof. Robert van Engelen.
Safe to the Last Instruction: Automated Verification of a Type-Safe Operating System Jean Yang MIT CSAIL Chris Hawblitzel Microsoft Research.
CSCI1600: Embedded and Real Time Software Lecture 28: Verification I Steven Reiss, Fall 2015.
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
Lecture 4 Page 1 CS 111 Online Modularity and Virtualization CS 111 On-Line MS Program Operating Systems Peter Reiher.
MIDORI The Windows Killer!! by- Sagar R. Yeole Under the guidance of- Prof. T. A. Chavan.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Efficient software-based fault isolation Robert Wahbe, Steven Lucco, Thomas Anderson & Susan Graham Presented by: Stelian Coros.
SAFE KERNEL EXTENSIONS WITHOUT RUN-TIME CHECKING George C. Necula Peter Lee Carnegie Mellon U.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
Specifying Multithreaded Java semantics for Program Verification Abhik Roychoudhury National University of Singapore (Joint work with Tulika Mitra)
Scott Finley University of Wisconsin – Madison CS 736 Project.
Language Based Operating Systems by Sean Olson What is a virtual machine? What is managed code? Kernels. Memory and security models. What is a language.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
EECS 262a Advanced Topics in Computer Systems Lecture 26 seL4 Kernel verification April 27 th, 2016 John Kubiatowicz Electrical Engineering and Computer.
Computer System Structures
The Post Windows Operating System
Operating System Structures
Types for Programs and Proofs
John Backes, Rockwell Collins Dan DaCosta, Rockwell Collins
The heavyweight parts of lightweight languages
Outline What does the OS protect? Authentication for operating systems
Outline What does the OS protect? Authentication for operating systems
Language-based Security
Outline Chapter 2 (cont) OS Design OS structure
John Backes, Rockwell Collins Dan DaCosta, Rockwell Collins
Presentation transcript:

Formally Verified Operating Systems SINGULARITY AND SEL4

Outline Formal Verification & Type Systems Singularity ◦Software-Isolated Processes ◦Contract-Based Channels ◦Manifest-Based Programs ◦Formal Verification seL4 ◦Assumptions ◦Design Path ◦Costs of Verification

Formal Verification in a nutshell Create a collection of rules Claim/Prove that those rules describe certain properties Check whether/Prove that something adheres to those rules ◦If yes, then that something has the above properties Properties may be very weak or very strong ◦Weak properties: easy to prove ◦Strong properties: may not be provable ◦Rice’s theorem: it is impossible to prove anything non-trivial for arbitrary programs

Formal Verification Example

Type Systems “The world’s best lightweight formal method” (Benjamin Pierce) Mainly for safety properties Static type-checking ◦Proving properties of your program ◦May need annotations from the programmer Almost all programming languages have type systems ◦But the static guarantees vary a lot

fun factorial(n) is if ( n == 1 ) return 1; else return n * factorial( n – 1 ); end; fun factorial(n : int) returns int is if ( n == 1 ) return 1; else return n * factorial( n – 1 ); end; fun factorial(n : int) { n > 0 } returns r : int { r == n! } is if ( n == 1 ) return 1; else return n * factorial( n – 1 ); end; Annotations

Note Not all equivalent programs are equally amenable to verification void swap(ptr A, ptr B) { ptr C := A; A := B; B := C; } void swap(ptr A, ptr B) { A := A xor B; B := A xor B; A := A xor B; } vs.

Singularity – Takeaway Goal PL techniques can make kernel & programs a lot safer Safe programs can run in kernel-space IPC is really fast when programs run in kernel-space (Reasonable?) restrictions on programs make the job of the OS much easier

Singularity - Authors Galen Hunt -University of Rochester (PhD, 1998) -Created prototype of Windows Media Player -Led Menlo, Experiment 19 and Singularity projects Jim Larus -UC Berkeley (PhD, 1989) -University of Wisconsin-Madison ( ) -University of Washington (2000-) -Microsoft Research (1997-) -eXtreme Computing Group ( )

Singularity – Design Goals - A dependable system ◦Catch errors as soon as possible Compile Time > Installation Time > Run Time Design TimeLoad Time

Singularity - 3 Core Ideas Software-Isolated Processes (SIPs) Contract-Based Channels Manifest-Based Programs

Software-Isolated Processes Programs written in a memory-safe language ◦Cannot access data of other processes Cannot dynamically load code Can only communicate with other processes via messages ◦Sender and receiver always known Kernel respects the above limitations, too Programs run in kernel-space Every process has its own runtime and GC

Contract-enforcing channels The only way of inter-process communication Endpoints always belong to specific threads ◦Can be passed to other programs via channels Sending data also transfers ownership of data ◦Process cannot access data anymore after sending it Adherence to communication protocol statically verifiable

Contract-enforcing channels contract C1 { in message Request(int x) requires x>0; out message Reply(int y); out message Error(); state Start: Request? -> (Reply! or Error!) -> Start; } Source: Singularity Technical Report, Hunt et al. (MSR-TR )

Manifests Manifests describe : ◦the complete program code ◦The program itself ◦All dependencies ◦the resources a program might access ◦the communication channels it offers Can be statically verified Guide install-time compilation

Manifests <ioMemoryRange index="0" baseAddress="0xf " rangeLength="0x400000" />... Source: Singularity Technical Report, Hunt et al. (MSR-TR )

Verification Mostly safety properties ◦Safe memory access ◦Guaranteed by the type system Support for contract-based verification ◦Enables verification of functional correctness ◦Not ubiquitously applied in kernel ◦Some parts are checked ◦Channel contracts ◦Manifests

Benefits of safety properties Source: Singularity Technical Report, Hunt et al. (MSR-TR )

Singularity’s Money Graph Source of Data: Sealing OS Processes to Improve Dependability and Safety, Hunt et al., EuroSys 2007

Takeaway PL techniques can make kernel & programs a lot safer Safe programs can run in kernel-space IPC is really fast when programs run in kernel-space (Reasonable?) restrictions on programs make the job of the OS much easier Discussion Can systems programmers live without C? Is the sharing of data between processes really not important?

seL4 – Takeaway Goal Functional verification of microkernels is possible Performance of verified kernels can be OK BUT: Verification is a colossal effort Still needs to assume compiler correctness (  huge trusted base)

seL4 - Authors Gerwin KleinKevin ElphinstoneGernot HeiserJune AndronickDavid Cock Philip DerrinKai Engelhardt Dhammika ElkaduweRafal Kolanski Michael Norrish Thomas Sewell Harvey Tuch Simon Winwood

seL4 – Project Leaders Gerwin Klein -TU Munich (PhD) -University of New South Wales -Does not put a CV on his webpage Kevin Elphinstone -University of New South Wales -Does not put a CV on his webpage -Collaborated with Jochen Liedtke (L4) Gernot Heiser -ETH Zurich (PhD, 1991) -University of New South Wales -Created Startup “Open Kernel Labs” to sell L4 technology -Collaborated with Jochen Liedtke (L4)

Secure L4 – Design Goal Create a formal model of a microkernel Implement the microkernel Prove that it always behaves according to the specification

Assumptions Hardware works correctly Compiler produces machine code that fits their formalization Some unchecked assembly code is correct Boot loader is correct

How to design kernel + spec? Bottom-Up-Approach: Concentrate on low-level details to maximize performance Problem: Produces complex design, hard to verify

Reminder Not all equivalent programs are equally amenable to verification void swap(ptr A, ptr B) { ptr C := A; A := B; B := C; } void swap(ptr A, ptr B) { A := A xor B; B := A xor B; A := A xor B; } vs.

How to design kernel + spec? Top-Down-Approach: Create formal model of kernel ◦Generate code from that Problem: High level of abstraction from hardware

How to design kernel + spec?

Concurrency is a problem Multiprocessors not included in the model ◦seL4 can only run on a single processor Interrupts are still there ◦Yield points need to establish all system invariants

Cost of Verification Source: seL4, Klein et al.

Cost of Verification Source of Data: seL4, Klein et al.

Takeaway Functional verification of microkernels is possible Performance of verified kernels can be OK BUT: Verification is a colossal effort Still needs to assume compiler correctness (  huge trusted base) Discussion Is proving functional correctness worth the effort?

Singularity vs. seL4 Goal SingularityseL4 A verifiably safe system. Kernel should fail “safely” when an error occurs. A verifiably correct system. There just should not be any errors. Ease of Verification SingularityseL4 Most guarantees come for free Annotations and contracts can give more guarantees Several person-years just for proving about 80 invariants.

Perspective Lots of room between Singularity and seL4 ◦I.e.: more parts of Singularity can be verified for functional correctness Both are verified microkernels ◦Good Isolation  additional components can be verified independently