Designing Systems for Push-Button Verification

Similar documents
Push-Button Verification of File Systems

Push-Button Verification of File Systems

Hyperkernel: Push-Button Verification of an OS Kernel

Push-button verification of Files Systems via Crash Refinement

Helgi Sigurbjarnarson

Nickel: A framework for design and verification of information flow control systems

Hyperkernel: Push-Button Verification of an OS Kernel

Verdi: A Framework for Implementing and Formally Verifying Distributed Systems

Using Crash Hoare Logic for Certifying the FSCQ File System

Gerwin Klein Kevin Elphinstone Gernot Heiser June Andronick David Cock Philip Derrin Dhammika Elkaduwe Kai Engelhardt Rafal Kolanski Michael Norrish

A Crash-Safe Key-Value Store Using Chained Copy-on-Write B-trees

Static Analysis of Embedded C Code

CS3210: Crash consistency

MultiNyx: A Multi-Level Abstraction Framework for Systematic Analysis of Hypervisors. Pedro Fonseca, Xi Wang, Arvind Krishnamurthy

File System Consistency. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Virtualization. Operating Systems, 2016, Meni Adler, Danny Hendler & Amnon Meisels

Using the Singularity Research Development Kit

File System Consistency

Translation Validation for a Verified OS Kernel

W4118 Operating Systems. Instructor: Junfeng Yang

Caching and reliability

Operating systems. Lecture 7 File Systems. Narcis ILISEI, oct 2014

CS 318 Principles of Operating Systems

Certifying a file system: Correctness in the presence of crashes

Nickel: A Framework for Design and Verification of Information Flow Control Systems

An External Integrity Checker for Increasing Security of Open Source Operating Systems

Implementing a Verified On-Disk Hash Table

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Computer Systems Laboratory Sungkyunkwan University

EXPLODE: a Lightweight, General System for Finding Serious Storage System Errors. Junfeng Yang, Can Sar, Dawson Engler Stanford University

Browser Security Guarantees through Formal Shim Verification

High-Level Information Interface

Arvind Krishnamurthy Spring Implementing file system abstraction on top of raw disks

Towards a Practical, Verified Kernel

Designing a True Direct-Access File System with DevFS

File Systems: Consistency Issues

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

File System Internals. Jo, Heeseung

Ironclad Apps: End-to-End Security via Automated Full-System Verification. Danfeng Zhang

Topics. File Buffer Cache for Performance. What to Cache? COS 318: Operating Systems. File Performance and Reliability

Docker for People. A brief and fairly painless introduction to Docker. Friday, November 17 th 11:00-11:45

Main Points. File layout Directory layout

System Call. Preview. System Call. System Call. System Call 9/7/2018

File System Implementation. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Type Theory meets Effects. Greg Morrisett

0x1A Great Papers in Computer Security

File Systems. CS 4410 Operating Systems. [R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse]

An Extensible Programming Language for Verified Systems Software. Adam Chlipala MIT CSAIL WG 2.16 meeting, 2012

TxFS: Leveraging File-System Crash Consistency to Provide ACID Transactions

disk writes, then a problem arises.

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University

OS Extensibility: SPIN and Exokernels. Robert Grimm New York University

Alive: Provably Correct InstCombine Optimizations

FS Consistency & Journaling

Towards Lean 4: Sebastian Ullrich 1, Leonardo de Moura 2.

VS 3 : SMT Solvers for Program Verification

Virtual File System. Don Porter CSE 306

Implementation should be efficient. Provide an abstraction to the user. Abstraction should be useful. Ownership and permissions.

File Systems Ch 4. 1 CS 422 T W Bennet Mississippi College

Diagnosing Production-Run Concurrency-Bug Failures. Shan Lu University of Wisconsin, Madison

COS 318: Operating Systems. Journaling, NFS and WAFL

CSE543 - Computer and Network Security Module: Virtualization

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand

[537] Journaling. Tyler Harter

File System Implementation

Operating System Security

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Types and Programming Languages. Lecture 6. Normalization, references, and exceptions

Kernel Support for Paravirtualized Guest OS

Unit 2 : Computer and Operating System Structure

Chapter 11: File System Implementation. Objectives

File system internals Tanenbaum, Chapter 4. COMP3231 Operating Systems

n HW7 due in about ten days n HW8 will be optional n No CLASS or office hours on Tuesday n I will catch up on grading next week!

CSC 5930/9010 Cloud S & P: Virtualization

Announcements. Persistence: Crash Consistency

CSE506: Operating Systems CSE 506: Operating Systems

The Slide does not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams.

Synthesis and Verification for All Emina Torlak

Evolution of the Unix File System Brad Schonhorst CS-623 Spring Semester 2006 Polytechnic University

Ext3/4 file systems. Don Porter CSE 506

Formal Specification of RISC-V Systems Instructions

Tricky issues in file systems

It was a dark and stormy night. Seriously. There was a rain storm in Wisconsin, and the line noise dialing into the Unix machines was bad enough to

Linearizability of Persistent Memory Objects

Logging, Monitoring, and Alerting

From Data to Effects Dependence Graphs: Source-to-Source Transformations for C

Fast File System (FFS)

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CrashMonkey: A Framework to Systematically Test File-System Crash Consistency. Ashlie Martinez Vijay Chidambaram University of Texas at Austin

JOURNALING FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 26

A concrete memory model for CompCert

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

by Alexander V. Konradi AU( 14?O17 C ertified by... M. Frans Kaashoek Charles Piper Professor

ECE 598 Advanced Operating Systems Lecture 18

CIS Operating Systems File Systems. Professor Qiang Zeng Spring 2018

CIS Operating Systems File Systems. Professor Qiang Zeng Fall 2017

Aerie: Flexible File-System Interfaces to Storage-Class Memory [Eurosys 2014] Operating System Design Yongju Song

Clotho: Transparent Data Versioning at the Block I/O Level

Current Topics in OS Research. So, what s hot?

ò Very reliable, best-of-breed traditional file system design ò Much like the JOS file system you are building now

Transcription:

Designing Systems for Push-Button Verification Luke Nelson, Helgi Sigurbjarnarson, Xi Wang Joint work with James Bornholt, Dylan Johnson, Arvind Krishnamurthy, EminaTorlak, Kaiyuan Zhang

Formal verification of systems Eliminate entire classes of bugs Write a spec & prove impl meets the spec COMPCERT Verification projects at UW: Bagpipe [OOPSLA 16], Neutrons [CAV 16], Verdi [PLDI 15],

Challenge 1/3: non-trivial efforts Time-consuming: often person-years Require high-level of expertise Example: the sel4 kernel 10 KLOC code, 480 KLOC proof 11 person-years

Challenge 2/3: spec What is a correct system Low-level correctness is well-understood: no overflow Some fields have been using formal specs: TLA+ Difficult in general Examples The file system must ensure crash safety The OS kernel must enforce process isolation

Challenge 3/3: integration w/ dev Learning curve Improve upon testing (e.g., Driver Verifier) Moving target Incremental deployment

Push-button verification System design for minimizing proof efforts Verifiability as a first-class concern Leverage advances in automated SMT solving But need to use solvers wisely Limitations on expressiveness

From static analysis to verification There has been a seismic shift in terms of the average programmer getting it. When you say you have a static bug-finding tool, the response is no longer Huh? or Lint? Yuck. This shift seems due to static bug finders being in wider use, giving rise to nice networking effects. A Few Billion Lines of Code Later: Using Static Analysis to Find Bugs in the Real World Coverity, CACM 2010

Outlines Yggdrasil: writing verified FSes [OSDI 16] Hyperkernel: a verified OS kernel [SOSP 17] Lessons learned & future work

Yggdrasil [OSDI 16] File systems are essential for data integrity But are difficult to get right Complex on-disk data structures Must ensure crash safety Bugs are hard to reproduce

FS challenges Too many states Disks are large; many execution paths Non-determinism: crash, reordering writes Techniques Testing: explode [OSDI 06], EXE [CCS 06] Interactive proving: FSCQ [SOSP 15], Cogent [ASPLOS 16] How to automate FS verification

Yggdrasil: writing verified FSes Key ideas A definition of FS correctness amenable to SMT solving Layering to scale verification Separating layout from correctness Main result: Yxv6 file system Similar to ext3 and xv6 Verified functional correctness Verified crash safety

Yggdrasil overview specification implementation consistency invariants pass verifier fail compiler optimizer visualizer C code for file system + fsck counterexample

Example spec class TxnDisk(BaseSpec): def begin_tx(self): self._txn = [] def write_tx(self, bid, data): self._cache = self._cache.update(bid, data) self._txn.append((bid, data)) def commit_tx(self): with self._mach.transaction(): for bid, data in self._txn: self._disk = self._disk.update(bid, data)

Strawman: doesn t capture crash Model FS as a state machine with a set of operations { create, rename, etc. } spec S0 S1 impl I0 I1 I2 I3

Crash refinement spec S0 S1 I4 I5 impl I0 I1 I2 I3

Crash refinement definition Model FS as a state machine Augment each op with an explicit crash schedule: op(disk, inp, sched) disk For each FS op, prove: disk, inp, sched impl. sched spec. op spec (disk, inp, sched spec ) = op impl (disk, inp, sched impl ) Z3 is good at solving this form

Stack of layered abstractions Each layer has a spec Each layer builds upon a lower layer spec Limit verification to a single layer at a time regular files, symbolic links, and directories Yxv6 files inodes Yxv6 inodes transactional disk write-ahead logging Crash refinement Crash refinement Crash refinement disk specification implementation

Separate refinement of layout Start with multiple disks & inefficient layout log disk file data disk log partition file data partition Gradually refine to optimized layout orphan inodes disk block bitmap disk packed block bitmap disk orphan inodes partition block bitmap partition Separate reasoning of correctness from layout inode bitmap disk inode metadata disk direct block pointers disk packed inode bitmap disk packed inodes disk inode bitmap parition inodes partition disk

Implementation w/ Python & Z3 Two Yxv6 variants Yxv6+sync: similar to xv6, FSCQ and ext4+sync Yxv6+group_commit: an optimized Yxv6+sync verified: 1.6 hours w/ 24 cores - no manual proofs! spec impl consistency inv. Yxv6 250 1,500 5 infrastructure -- 1,500 -- FUSE stub -- 250 --

Run-time performance 3 150 faster than ext4+sync Within 10 of ext4+default Running time in seconds 1000 100 10 1 0.1 0.01 fscq ext4+sync yxv6+sync yxv6+group_commit ext4+default 0.001 Make Bash Make yxv6 Mailbench Largefile Smallfile

Summary of Yggdrasil Push-button verification is feasible for FS No manual proofs on implementation New FS correctness definition: crash refinement FS design for verification Model FS as a state machine Verify each operation using crash refinement Verify each layer independently

Hyperkernel [SOSP 17] The OS Kernel is a critical component Isolation is essential for application security Kernel bugs can compromise the entire system Manual verification is costly Goal: OS design for automated SMT verification

Design challenges Kernel API must be amenable to SMT reasoning Kernel pointers are difficult to reason about kernel runs under virtual memory kernel also manipulates the mapping the mapping is often non-injective C is known to be difficult to model

Ideas: design to scale verification Finite interface: no loops/interrupts in kernel Use SMT-friendly data structures (e.g., bitmaps) Use validation whenever possible Identity mapping in kernel Separate address spaces in kernel and user Abuse virtual machine instructions Verification using LLVM IR instead of C SMT encodings for reference counting, etc.

Model OS as a state machine process... process user-kernel interface trap handler user kernel Assume a uniprocessor system Assume initialization and glue code correct

Main theorems declarative specication P state-machine specication S i 1 S i S i+1 implementation I i 1 I i I i+1

Workflow Python declarative specication state-machine specication verier proof or test case syscall/interrupt handler & invariant LLVM C front-end LLVM IR kernel initialization & glue code C & assembly LLVM compiler kernel image

Demo Workflow Virtual memory management

Summary of Hyperkernel Feasible to verify a simple Unix-like OS kernel Make interface finite, exokernel -y Leverage advances in HW and formal methods Starting point for verifying applications+os

Lessons learned Event-driven systems A set of atomic handlers Encode finite handlers in SMT Add layers (if needed) to scale up verification Co-design systems w/ SMT Use effectively decidable theories whenever possible Restricted use of quantifiers

Conclusion Push-button verification Examples: file system, OS kernel Reusable design patterns and toolchains Verifiability as a first-class system design concern

Deployability Run a hypervisor as a guest on a verified shim. Enforce memory is protected from other guests and from hypervisor. Rely on hypervisor for device and policy implementation. Hypervisor Guest Guest Verified Shim

Key design ideas Explicit resource allocation and reclamation Require user space to make decisions about resources, eliminating need for allocators or garbage collectors in kernel Finitizesystem call interface Should complete in constant time, independent of parameters, eliminating need to reason about loops or long-running system calls