Push-Button Verification of File Systems

Similar documents
Push-Button Verification of File Systems

Designing Systems for Push-Button Verification

Push-button verification of Files Systems via Crash Refinement

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

Hyperkernel: Push-Button Verification of an OS Kernel

Helgi Sigurbjarnarson

Using Crash Hoare Logic for Certifying the FSCQ File System

Certifying a file system: Correctness in the presence of crashes

Hyperkernel: Push-Button Verification of an OS Kernel

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Static Analysis. Emina Torlak

Static program checking and verification

Verdi: A Framework for Implementing and Formally Verifying Distributed Systems

disk writes, then a problem arises.

System Correctness. EEC 421/521: Software Engineering. System Correctness. The Problem at Hand. A system is correct when it meets its requirements

Turning proof assistants into programming assistants

Program Verification (6EC version only)

Cross-checking Semantic Correctness: The Case of Finding File System Bugs

School of Computer & Communication Sciences École Polytechnique Fédérale de Lausanne

Reducing Crash Recoverability to Reachability

Simulink 모델과 C/C++ 코드에대한매스웍스의정형검증툴소개 The MathWorks, Inc. 1

Modular Verification of Order-Preserving Write-Back Caches

CS3210: Crash consistency

Implementing a Verified On-Disk Hash Table

Designing a True Direct-Access File System with DevFS

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

Research Collection. Formal background and algorithms. Other Conference Item. ETH Library. Author(s): Biere, Armin. Publication Date: 2001

Having a BLAST with SLAM

CSE 333 Lecture 9 - storage

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

Outline. Introduction SDV Motivation Model vs Real Implementation SLIC SDVRP SLAM-2 Comparisons Conclusions

Type Theory meets Effects. Greg Morrisett

Software Testing CS 408. Lecture 11: Review 2/20/18

University of Wisconsin-Madison

Runtime Checking for Program Verification Systems

JML tool-supported specification for Java Erik Poll Radboud University Nijmegen

K and Matching Logic

Part II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs?

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

Main Goal. Language-independent program verification framework. Derive program properties from operational semantics

Having a BLAST with SLAM

Software Security: Vulnerability Analysis

Race Catcher. Automatically Pinpoints Concurrency Defects in Multi-threaded JVM Applications with 0% False Positives.

ABHELSINKI UNIVERSITY OF TECHNOLOGY

A Mini Challenge: Build a Verifiable Filesystem

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

ECE 587 Hardware/Software Co-Design Lecture 11 Verification I

Program Verification. Aarti Gupta

ESC/Java2 Use and Features

Static Analysis in Practice

To be or not programmable Dimitri Papadimitriou, Bernard Sales Alcatel-Lucent April 2013 COPYRIGHT 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED.

Leveraging Formal Methods for Verifying Models and Embedded Code Prashant Mathapati Application Engineering Group

ESC/Java2 Use and Features

VeriCon: Towards Verifying Controller Programs in SDNs

Symbolic and Concolic Execution of Programs

Mechanized Operational Semantics

ESC/Java2 Use and Features David Cok, Joe Kiniry, Erik Poll Eastman Kodak Company, University College Dublin, and Radboud University Nijmegen

Flashix: Results and Perspective. Jörg Pfähler, Stefan Bodenmüller, Gerhard Schellhorn, (Gidon Ernst)

The Google File System

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

Having a BLAST with SLAM

Matching Logic. Grigore Rosu University of Illinois at Urbana-Champaign

Linearizability of Persistent Memory Objects

JOURNALING FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 26

Automatic Generation of Program Specifications

Introduction to Problem Solving and Programming in Python.

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine

Formal Methods and their role in Software and System Development. Riccardo Sisto, Politecnico di Torino

Areas related to SW verif. Trends in Software Validation. Your Expertise. Research Trends High level. Research Trends - Ex 2. Research Trends Ex 1

Formal Verification! Prof. Leon Osterweil! Computer Science 520/620! Spring 2012!

Practical Formal Verification of Domain-Specific Language Applications

Q Body of techniques supported by. R precise mathematics. R powerful analysis tools. Q Rigorous, effective mechanisms for system.

In Our Last Exciting Episode

! Use of formal notations. ! in software system descriptions. ! for a broad range of effects. ! and varying levels of use. !

Outline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context

Cover Page. The handle holds various files of this Leiden University dissertation

Symbolic Execution, Dynamic Analysis

Using the Singularity Research Development Kit

Static Analysis! Prof. Leon J. Osterweil! CS 520/620! Fall 2012! Characteristics of! System to be! built must! match required! characteristics!

COS 318: Operating Systems. Journaling, NFS and WAFL

CSE 403: Software Engineering, Fall courses.cs.washington.edu/courses/cse403/16au/ Unit Testing. Emina Torlak

Towards Efficient, Portable Application-Level Consistency

StorageCraft OneXafe and Veeam 9.5

CMPSC 497: Static Analysis

Global Optimization. Lecture Outline. Global flow analysis. Global constant propagation. Liveness analysis. Local Optimization. Global Optimization

File System Performance (and Abstractions) Kevin Webb Swarthmore College April 5, 2018

High-Level Information Interface

Runtime Checking and Test Case Generation for Python

Specifying the Ethereum Virtual Machine for Theorem Provers

Adam Chlipala University of California, Berkeley ICFP 2006

Leveraging Formal Methods Based Software Verification to Prove Code Quality & Achieve MISRA compliance

Code BEAM SF Hype For Types. Using Dialyzer to bring type checking to your Elixir code

Verification and Validation

Verification and Validation

Verified Secure Routing

Symbolic Execution. Joe Hendrix Galois, Inc SMT Summer School galois

Automatic Software Verification

CITS5501 Software Testing and Quality Assurance Formal methods

TWO-PHASE COMMIT ATTRIBUTION 5/11/2018. George Porter May 9 and 11, 2018

IronFleet. Dmitry Bondarenko, Yixuan Chen

MC: Meta-level Compilation

Transcription:

1 / 24 Push-Button Verification of File Systems via Crash Refinement Helgi Sigurbjarnarson, James Bornholt, Emina Torlak, Xi Wang University of Washington

2 / 24 File systems are hard to get right Complex hierarchical on-disk data structures Maintain consistency in the face of crashes

3 / 24 Example: Missing flush in ext4 Bugs are hard to reproduce Hard to test fixes It s unlikely this will be necessary [..] but we need this in order to guarantee correctness. File System Developers

4 / 24 Verification: Effective at eliminating bugs, but costly Prove the absence of bugs BilbyFS [ASPLOS 2016] FSCQ [SOSP 2015] Requires expertise and are labor intensive impl 2,000 proof 20,000

5 / 24 Goal: Push-button verification No manual annotation / proof of implementation Get a concrete test case for any bug Our approach: System design to leverage a state-of-the-art automated theorem prover, Z3.

6 / 24 Push-button verification: Challenges Need a formalization of correctness Needs to capture crash & recovery Needs to be automatically verifiable Too many states to exhaust Disks are large Many execution paths Non-determinism Prior work focused on bug finding explode [OSDI 06], EXE [CCS 06] Useful, but incomplete

7 / 24 Contributions and outlines Yggdrasil [ yg:,drasil:]: A toolkit for building verified file systems Crash refinement A new definition of file-system correctness Enable modularity to scale verification Case study: The Yxv6 file system Similar to ext3 and xv6, but guarantees functional correctness and crash safety

8 / 24 Yggdrasil Overview (Green trusted components) specification implementation consistency invariants pass verifier fail compiler visualizer C code for file system counterexample

8 / 24 Yggdrasil Overview (Green trusted components) specification implementation consistency invariants pass verifier fail compiler visualizer C code for file system counterexample

8 / 24 Yggdrasil Overview (Green trusted components) specification implementation consistency invariants class TxnDisk(BaseSpec): pass def begin_tx(self): self._txn = [] verifier fail defcompiler write_tx(self, bid, data): visualizer self._cache = self._cache.update(bid, data) self._txn.append((bid, data)) C code for file system counterexample def commit_tx(self): with self._mach.transaction(): for bid, data in self._txn: self._disk = self._disk.update(bid, data)

8 / 24 Yggdrasil Overview (Green trusted components) specification implementation consistency invariants pass verifier fail compiler visualizer C code for file system counterexample

8 / 24 Yggdrasil Overview (Green trusted components) specification implementation consistency invariants pass verifier fail compiler visualizer C code for file system counterexample

8 / 24 Yggdrasil Overview (Green trusted components) specification implementation consistency invariants pass verifier fail compiler visualizer C code for file system counterexample

8 / 24 Yggdrasil Overview (Green trusted components) specification implementation consistency invariants pass verifier fail compiler visualizer C code for file system counterexample

9 / 24 Summary of the Yggdrasil toolkit Easy to use, no complex logic required Useful test-cases for bugs Limitations No concurrency Unverified Python to C compiler and FUSE

10 / 24 Straw-man approach to verify FS Model FS as a state machine with a set of operations {mknod, rename, etc.}. spec S0 S1 impl I0 I1 I2 I3 Limitation: Doesn t capture crashes

11 / 24 Crash refinement: Intuition spec S0 S1 I4 I5 impl I0 I1 I2 I3 Formalize this intuition 1 Capture crashes explicitly with a crash schedule 2 Use the crash schedule to define correctness

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings Operation Schedule Disk state write(a1, v 1) write(a2, v 2)

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings Operation Schedule Disk state write(a1, v 1) write(a2, v 2)

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings Operation Schedule Disk state write(a1, v 1) {b1} write(a2, v 2)

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings Operation Schedule Disk state write(a1, v1) {b1} d [a1 if b1 then v1 else old(a1)] write(a2, v 2)

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings Operation Schedule Disk state write(a1, v1) {b1} d [a1 if b1 then v1 else old(a1)] write(a2, v 2)

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings Operation Schedule Disk state write(a1, v1) {b1} d [a1 if b1 then v1 else old(a1)] write(a2, v 2) {b1, b2}

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings Operation Schedule Disk state write(a1, v1) {b1} d [a1 [ if b1 then v1 else old(a1)] ] a1 if b1 then v1 else old(a1) write(a2, v 2) {b1, b2} d a2 if b2 then v2 else old(a2)

12 / 24 Crash refinement 1 /2: Crash schedule Explicit crash-schedule A set of boolean variables Captures crashes and disk reorderings Operation Schedule Disk state write(a1, v1) {b1} d [a1 [ if b1 then v1 else old(a1)] ] a1 if b1 then v1 else old(a1) write(a2, v 2) {b1, b2} d a2 if b2 then v2 else old(a2) Note: this program can produce 4 possible states

13 / 24 Crash refinement 2 /2: Definition 1 Augment each op in FS with an explicit crash schedule: op(disk, inp, sched) disk 2 For each op FS, 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 particular form

13 / 24 Crash refinement 2 /2: Definition 1 Augment each op in FS with an explicit crash schedule: op(disk, inp, sched) disk implementation states 2 For each op FS, 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 particular form

13 / 24 Crash refinement 2 /2: Definition 1 Augment each op in FS with an explicit crash schedule: op(disk, inp, sched) disk 2 For each op FS, prove: specification states disk, inp, sched impl. sched spec. op spec (disk, inp, sched spec ) = op impl (disk, inp, sched impl ) Z3 is good at solving this particular form

14 / 24 Crash refinement summary Amenable to automatic verification using Z3 Enables modular, scalable verification Example: Decouple logical / physical data layout Verify a simple layout first (ex. one inode per block) Prove a separate crash-refinement for efficient layout Example: Stacking of layered abstractions

15 / 24 Verifying multiple layers: Straw-man approach regular files, symbolic links, and directories xv6 files xv6 inodes write-ahead logging disk specification implementation

15 / 24 Verifying multiple layers: Straw-man approach regular files, symbolic links, and directories xv6 files xv6 inodes write-ahead logging disk specification implementation

16 / 24 Yxv6 file system: Stack of layered abstractions Each layer has a specification Each layer builds upon a lower layer specification 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 disk specification implementation Crash refinement Crash refinement Crash refinement

17 / 24 Implementation using Python and Z3 Two Yxv6 variants Yxv6+sync: similar to xv6, FSCQ and ext4+sync Yxv6+group_commit: an optimized Yxv6+sync component specification implementation consistency inv Yxv6 250 1,500 5 infrastructure 1,500 FUSE stub 250 Also built: YminLFS, Ycp and Ylog No manual proofs!

18 / 24 Yxv6 evaluation 1 How long does it take to verify? 2 Is the implementation actually correct? 3 What is the development effort for Yxv6? 4 Is the performance of Yxv6 reasonable?

19 / 24 Yxv6 evaluation 1 /4: Verification time Let s see how many days it takes to verify Yxv6+sync

20 / 24 Yxv6 evaluation 2 /4: Correctness Passed Linux testing project s fsstress Passed SibylFS [SOSP 15] Posix compliance test Except for incomplete features (ex. hard links, acl) Passed manual crash and inspection tests Self hosting its development on Linux

21 / 24 Yxv6 evaluation 3 /4: Development effort 4 months exploring ways to scale verification 2-3 months building Yxv6+sync until self hosting Past 6 months: Experiment with optimizations

22 / 24 Yxv6 evaluation 4 /4: Runtime performance Yxv6+sync similar to FSCQ and ext4+sync Yxv6+group_commit 3 150 faster than ext4+sync Within 10 of ext4+default 1000 100 fscq ext4+sync yxv6+sync Running time in seconds 10 1 0.1 0.01 0.001 Make Bash Mailbench

22 / 24 Yxv6 evaluation 4 /4: Runtime performance Yxv6+sync similar to FSCQ and ext4+sync Yxv6+group_commit 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 Mailbench

Yxv6 evaluation 1 /4: Verification time revisited 23 / 24

23 / 24 Yxv6 evaluation 1 /4: Verification time revisited Yxv6+sync takes about a minute to verify Yxv6+group_commit Larger log, longer verification time. 1.6 hours using 24 cores

24 / 24 Conclusion Push-button verification is feasible for FS No manual proofs on implementation Generate test-cases for bugs Design systems to enable automatic, modular verification Towards integration of verification into daily development