Advancing Deductive Program-Level Verification for Real-World
Total Page:16
File Type:pdf, Size:1020Kb
Advancing Deductive Program-Level Verification for Real-World Application Lessons Learned from an Industrial Case Study Zur Erlangung des akademischen Grades eines Doktors der Naturwissenschaften von der Fakultät für Informatik des Karlsruher Instituts für Technologie (KIT) genehmigte Dissertation von Thorsten Bormer aus Koblenz Datum der mündlichen Prüfung: 23. Oktober 2014 Referent: Prof. Dr. Bernhard Beckert Korreferenten: Dr. Claude Marché Assoc. Prof. Dr. Wolfgang Ahrendt Contents Zusammenfassung ix 1 Introduction 1 1.1 Formal Methods in Practice: the Verisoft Projects . .2 1.2 Current State of Deductive Verification . .4 1.3 Contents and Structure of the Thesis . .4 1.3.1 Part I – Verifying a Paravirtualizing Hypervisor . .5 1.3.2 Part II – Improving the Verification Process . .7 1.4 Contributions . .8 1.5 Previously Published Material . .9 I Deductive Verification of an Industrial Microkernel 12 2 Preliminaries 13 2.1 System Virtualization . 13 2.1.1 Operating Systems . 13 2.1.2 Full System Virtualization . 14 2.1.3 Paravirtualization . 16 2.2 PowerPC . 17 2.2.1 Memory Management . 17 2.2.2 Interrupts . 18 2.3 PikeOS – An Industrial Microkernel for System Virtualization . 19 2.4 Deductive Verification . 24 2.4.1 The VCC System . 24 2.4.2 The KeY System . 31 3 Verifying a Paravirtualizing Microkernel 35 3.1 Correctness of Virtualization Kernels as Simulation Property . 37 3.1.1 Simulations . 37 3.1.2 The PikeOS Simulation Theorem . 38 3.2 Simulation Proofs with VCC . 41 3.2.1 Sequential Systems . 42 3.2.2 Verifying PikeOS System Calls – Sequential Execution . 43 3.2.3 Concurrency . 48 Contents 3.3 Ingredients for Pervasive Correctness . 56 3.4 Related Work . 58 3.4.1 The Hypervisor Verification Project of Verisoft XT . 59 3.4.2 The L4.verified Project . 60 4 Lessons Learned from PikeOS Verification 61 4.1 Formalizing Requirements . 62 4.2 Adding Auxiliary Annotations . 64 4.2.1 Modularization . 65 4.2.2 Abstraction . 67 4.3 Local Verification . 69 4.4 Handling Software Evolution . 71 II Improving Deductive Verification for Real-World Application 73 5 The Auto-Active Verification Paradigm 77 5.1 Introduction . 77 5.1.1 The Possible Outcomes of Invoking an Annotation-based Verifica- tion Tool . 78 5.2 Distinguishing Different Kinds of Annotations . 79 5.2.1 Annotations and their Properties . 79 5.2.2 Annotations and Existence of Proofs . 80 5.2.3 Possible Failures in Authoring Annotations . 84 5.2.4 Improving the Annotation Languages and Methodologies . 86 6 Improving Trust in Verification Systems 88 6.1 Targets of Evaluation . 89 6.2 Test Cases for Program Verification Systems . 90 6.3 Testing Different Properties . 91 6.4 Axiomatization Coverage . 93 6.4.1 Completeness Coverage . 94 6.4.2 Soundness Coverage . 96 6.5 Case Studies . 97 6.5.1 Testing the Axiomatization of VCC . 99 6.5.2 Testing the Calculus Rules of KeY . 100 6.6 Improving Performance of Axiomatization Coverage Computation . 108 6.7 Improving Completeness Coverage of Existing Test Suites . 109 6.8 Related Work . 110 6.9 Conclusions and Future Work . 112 iii Contents 7 Improving Feedback for Verification 114 7.1 Preliminaries . 115 7.1.1 Verification Targets . 115 7.1.2 Annotations and Their Semantics . 116 7.1.3 The Verification Task . 116 7.1.4 The Modular Verification Process . 117 7.1.5 Top-down and Bottom-up Verification . 117 7.1.6 Bounded Software Verification . 118 7.1.7 The Low-Level Bounded Model Checker (LLBMC) . 120 7.2 Deductive Verification of Large Software Systems . 121 7.2.1 Object Orientation . 122 7.3 The Integrated Verification Process . 123 7.4 A Typical Specification Scenario . 128 7.4.1 The Program to be Verified . 128 7.4.2 Local Verification . 130 7.4.3 Global Verification . 132 7.5 Evaluation . 135 7.5.1 Checking Program Correctness with with LLBMC . 135 7.5.2 Improving Performance of Specification Checking . 138 7.6 Related Work . 143 7.7 Conclusion and Future Work . 145 8 Specification Using Abstract Data Types 148 8.1 Specifying Operations on Abstract Data Types – A Simple Case Study . 148 8.1.1 The VCC Approach . 149 8.1.2 The KeY Approach . 151 8.2 Separation of Concerns: Annotation-based Verification and Algebraic Specifications . 153 8.3 Related and Future Work . 156 8.4 Conclusion . 157 9 Conclusions 159 iv List of Figures and Tables 2 Preliminaries 2.1 Operating system privilege separation. 14 2.2 Typical paravirtualization and full virtualization system setups. 16 2.3 A typical PikeOS virtualization setup featuring isolated guest systems. 20 2.4 The VCC toolchain architecture . 25 2.5 VCC integration into the Visual Studio IDE and Model Viewer . 26 2.8 Graphical user interface of the KeY verification system . 34 3 Verifying a Paravirtualizing Microkernel 3.1 Overview of the specification state for PikeOS verification . 40 3.7 Overall PikeOS specification structure . 52 6 Improving Trust in Verification Systems 6.1 The different results of tests for auto-active verification systems and the failures they indicate. 91 6.3 Frequencies of runtimes for test cases of the KeY test suite . 98 6.4 Axiomatization coverage measures for the first VCC experiment . 100 6.5 Taclet coverage data for the KeY test suite by taclet and test case . 103 6.6 Groups of similar KeY test cases in terms of taclet coverage . 105 6.7 Taclet coverage counts for the KeY test suite . 106 6.8 Average test case selectivity by taclet for the KeY test suite . 107 7 Improving Feedback for Verification 7.1 Reasoning about functional correctness of a sample program . 118 7.2 Example for weakest precondition computation . 119 7.3 Comparison of regular VCC workflow with our CEGMAR process. 123 7.4 Excerpt from the requirement specification of copyNoDuplicates and its translation into LLBMC input . 128 7.11 Performance of exhaustive specification checks with LLBMC . 139 7.12 Performance results checking specifications for single problem instances 141 7.13 Comparison of LLBMC performance for checking specifications using different optimization strategies . 142 List of Algorithms and Listings 2 Preliminaries 2.6 Example VCC function contract . 27 2.7 JavaDL proof obligation for method min..................... 33 3 Verifying a Paravirtualizing Microkernel 3.2 Implementation of the PikeOS system call to change thread priority . 45 3.3 Excerpt of abstract PikeOS model (C data structure definition) . 46 3.4 Annotations for verifying function to set thread priority . 47 3.5 Lock data structure specification . 50 3.6 Lock operation contracts . 51 3.8 Annotated PikeOS global kernel information data strucure . 52 3.9 Annotated top-level specification structure . 53 3.10 Annotated implementation for verifying p4_runner_changeprio in the concurrent setting. 56 5 The Auto-Active Verification Paradigm 5.1 Annotated implementation computing the smallest element of an array 85 6 Improving Trust in Verification Systems 6.2 Algorithm to compute completeness axiomatization coverage . 97 6.9 A Java test case for qualified class instance creation . 108 6.10 Algorithm to generate completeness regression tests . 110 7 Improving Feedback for Verification 7.5 Implementation of copyNoDuplicates and insert .............. 129 7.6 Partial method contract for function insert .................. 131 7.7 Method contract of function copyNoDuplicates ................ 131 7.8 Auxiliary annotations for function copyNoDuplicates ............ 133 7.9 Example for wrapper function to establish pre-state for checking method contracts with LLBMC . 136 7.10 Method contract of function copyNoDuplicates for LLBMC . 137 List of Algorithms and Listings 8 Specification.