Poirot – A Concurrency Sleuth Shaz Qadeer Research in Software Engineering Microsoft Research.

Slides:



Advertisements
Similar presentations
CHESS : Systematic Testing of Concurrent Programs
Advertisements

Using SMT solvers for program analysis Shaz Qadeer Research in Software Engineering Microsoft Research.
Adopt Algorithm for Distributed Constraint Optimization
A Program Transformation For Faster Goal-Directed Search Akash Lal, Shaz Qadeer Microsoft Research.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Α ϒ ʎ …… Reachability Modulo Theories Akash Lal Shaz Qadeer, Shuvendu Lahiri Microsoft Research.
Give qualifications of instructors: DAP
1 Symbolic Execution for Model Checking and Testing Corina Păsăreanu (Kestrel) Joint work with Sarfraz Khurshid (MIT) and Willem Visser (RIACS)
1/20 Generalized Symbolic Execution for Model Checking and Testing Charngki PSWLAB Generalized Symbolic Execution for Model Checking and Testing.
ESP: A Language for Programmable Devices Sanjeev Kumar, Yitzhak Mandelbaum, Xiang Yu, Kai Li Princeton University.
Background for “KISS: Keep It Simple and Sequential” cs264 Ras Bodik spring 2005.
Reducing Context-bounded Concurrent Reachability to Sequential Reachability Gennaro Parlato University of Illinois at Urbana-Champaign Salvatore La Torre.
CHESS: Systematic Concurrency Testing Tom Ball, Sebastian Burckhardt, Madan Musuvathi, Shaz Qadeer Microsoft Research
Iterative Context Bounding for Systematic Testing of Multithreaded Programs Madan Musuvathi Shaz Qadeer Microsoft Research.
CHESS: A Systematic Testing Tool for Concurrent Software CSCI6900 George.
Tom Ball, Sebastian Burckhardt, Madan Musuvathi, Shaz Qadeer Microsoft Research.
 Thomas Ball Principal Researcher Microsoft Corporation  Sebastian Burckhardt Researcher Microsoft Corporation  Madan Musuvathi Researcher Microsoft.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Computer Systems/Operating Systems - Class 8
Discovering Affine Equalities Using Random Interpretation Sumit Gulwani George Necula EECS Department University of California, Berkeley.
SEERE Workshop, Neum Tempura Retargeting Damyan Mitev, Vladimir Valkanov Plovdiv University “Paisii Hilendarski”
On Sequentializing Concurrent Programs Ahmed Bouajjani LIAFA, University of Paris 7, France LIAFA, University of Paris 7, France Michael Emmi LIAFA, University.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process: Some Info. Motivation for threads! Two fundamental aspects of a “process”: Resource ownership Scheduling.
Context-bounded model checking of concurrent software Shaz Qadeer Microsoft Research Joint work with: Jakob Rehof, Microsoft Research Dinghao Wu, Princeton.
Precise Inter-procedural Analysis Sumit Gulwani George C. Necula using Random Interpretation presented by Kian Win Ong UC Berkeley.
Thread-modular Abstraction Refinement Tom Henzinger Ranjit Jhala Rupak Majumdar [UC Berkeley] Shaz Qadeer [Microsoft Research]
Synergy: A New Algorithm for Property Checking
CUDA Programming Lei Zhou, Yafeng Yin, Yanzhi Ren, Hong Man, Yingying Chen.
Debugging Concurrent Software by Context-Bounded Analysis Shaz Qadeer Microsoft Research Joint work with: Jakob Rehof, Microsoft Research Dinghao Wu, Princeton.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
Part 2: Reachability analysis of stack-based systems.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Taming Concurrency: A Program Verification Perspective Shaz Qadeer Microsoft Research.
0 Deterministic Replay for Real- time Software Systems Alice Lee Safety, Reliability & Quality Assurance Office JSC, NASA Yann-Hang.
Towards Scalable Modular Checking of User-defined Properties Thomas Ball, MSR Brian Hackett, Mozilla Shuvendu Lahiri, MSR Shaz Qadeer, MSR Julien Vanegue,
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Operating System Review September 10, 2012Introduction to Computer Security ©2004 Matt Bishop Slide #1-1.
A Simple Method for Extracting Models from Protocol Code David Lie, Andy Chou, Dawson Engler and David Dill Computer Systems Laboratory Stanford University.
Threads, Thread management & Resource Management.
Runtime Refinement Checking of Concurrent Data Structures (the VYRD project) Serdar Tasiran Koç University, Istanbul, Turkey Shaz Qadeer Microsoft Research,
Software Engineering Research paper presentation Ali Ahmad Formal Approaches to Software Testing Hierarchal GUI Test Case Generation Using Automated Planning.
CS6133 Software Specification and Verification
Dynamic Analysis of Multithreaded Java Programs Dr. Abhik Roychoudhury National University of Singapore.
Race Checking by Context Inference Tom Henzinger Ranjit Jhala Rupak Majumdar UC Berkeley.
NVIDIA Fermi Architecture Patrick Cozzi University of Pennsylvania CIS Spring 2011.
Parameterized Verification of Thread-safe Libraries Thomas Ball Sagar Chaki Sriram K. Rajamani.
1 Generating FSMs from Abstract State Machines Wolfgang Grieskamp Yuri Gurevich Wolfram Schulte Margus Veanes Foundations of Software Engineering Microsoft.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Chapter 5: Control Structures II (Repetition). Objectives In this chapter, you will: – Learn about repetition (looping) control structures – Learn how.
Context-bounded model checking of concurrent software Shaz Qadeer Microsoft Research Joint work with: Jakob Rehof, Microsoft Research Dinghao Wu, Princeton.
Department of Computer Science and Software Engineering
The Yogi Project Software property checking via static analysis and testing Aditya V. Nori, Sriram K. Rajamani, Sai Deep Tetali, Aditya V. Thakur Microsoft.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
Threads, Thread management & Resource Management.
Compositionality Entails Sequentializability Pranav Garg, P. Madhusudan University of Illinois at Urbana-Champaign.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Shangkar Mayanglambam, Allen D. Malony, Matthew J. Sottile Computer and Information Science Department Performance.
SEERE Workshop, Ivanjica JTempura Vladimir Valkanov, Damyan Mitev Plovdiv University “Paisii Hilendarski”
( = “unknown yet”) Our novel symbolic execution framework: - extends model checking to programs that have complex inputs with unbounded (very large) data.
/ PSWLAB Thread Modular Model Checking by Cormac Flanagan and Shaz Qadeer (published in Spin’03) Hong,Shin Thread Modular Model.
CHESS Finding and Reproducing Heisenbugs in Concurrent Programs
Agenda  Quick Review  Finish Introduction  Java Threads.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
On Sequentializing Concurrent Programs
Verification for Concurrent Programs
Over-Approximating Boolean Programs with Unbounded Thread Creation
Chapter 1 Introduction(1.1)
Foundations and Definitions
Presentation transcript:

Poirot – A Concurrency Sleuth Shaz Qadeer Research in Software Engineering Microsoft Research

Concurrent programming is difficult

… if (irp->Cancel) { IoCompleteIrp(irp); } else { IoSetCancelRoutine(irp, CancelRoutine); IoMarkIrpPending(irp); } … irp->Cancel = TRUE; fn = IoSetCancelRoutine(Irp, NULL); if (fn) { fn(irp); } … void CancelRoutine(IRP *irp) { IoCompleteIrp(irp); } NormalCancellation IO_REQUEST_PACKET *irp; irp->Cancel = FALSE; irp->CancelRoutine = NULL;

… if (irp->Cancel) { IoCompleteIrp(irp); } else { IoSetCancelRoutine(irp, CancelRoutine); IoMarkIrpPending(irp); } … irp->Cancel = TRUE; fn = IoSetCancelRoutine(Irp, NULL); if (fn) { fn(irp); } … void CancelRoutine(IRP *irp) { IoCompleteIrp(irp); } NormalCancellation IO_REQUEST_PACKET *irp; irp->Cancel = FALSE; irp->CancelRoutine = NULL;

… if (irp->Cancel) { IoCompleteIrp(irp); } else { IoSetCancelRoutine(irp, CancelRoutine); IoMarkIrpPending(irp); } … irp->Cancel = TRUE; fn = IoSetCancelRoutine(Irp, NULL); if (fn) { fn(irp); } … void CancelRoutine(IRP *irp) { IoCompleteIrp(irp); } NormalCancellation IO_REQUEST_PACKET *irp; irp->Cancel = FALSE; irp->CancelRoutine = NULL;

… if (irp->Cancel) { IoCompleteIrp(irp); } else { IoSetCancelRoutine(irp, CancelRoutine); IoMarkIrpPending(irp); } … irp->Cancel = TRUE; fn = IoSetCancelRoutine(Irp, NULL); if (fn) { fn(irp); } … void CancelRoutine(IRP *irp) { IoCompleteIrp(irp); } NormalCancellation IO_REQUEST_PACKET *irp; irp->Cancel = FALSE; irp->CancelRoutine = NULL;

… if (irp->Cancel) { IoCompleteIrp(irp); } else { IoSetCancelRoutine(irp, CancelRoutine); IoMarkIrpPending(irp); } … irp->Cancel = TRUE; fn = IoSetCancelRoutine(Irp, NULL); if (fn) { fn(irp); } … void CancelRoutine(IRP *irp) { IoCompleteIrp(irp); } NormalCancellation IO_REQUEST_PACKET *irp; irp->Cancel = FALSE; irp->CancelRoutine = NULL;

… if (irp->Cancel) { IoCompleteIrp(irp); } else { IoSetCancelRoutine(irp, CancelRoutine); IoMarkIrpPending(irp); } … irp->Cancel = TRUE; fn = IoSetCancelRoutine(Irp, NULL); if (fn) { fn(irp); } … void CancelRoutine(IRP *irp) { IoCompleteIrp(irp); } NormalCancellation IO_REQUEST_PACKET *irp; irp->Cancel = FALSE; irp->CancelRoutine = NULL;

… if (irp->Cancel) { IoCompleteIrp(irp); } else { IoSetCancelRoutine(irp, CancelRoutine); IoMarkIrpPending(irp); } … irp->Cancel = TRUE; fn = IoSetCancelRoutine(Irp, NULL); if (fn) { fn(irp); } … void CancelRoutine(IRP *irp) { IoCompleteIrp(irp); } NormalCancellation Fatal error! IO_REQUEST_PACKET *irp; irp->Cancel = FALSE; irp->CancelRoutine = NULL;

Concurrent programming is difficult Multiple loci of control resulting in non-local control flow Code difficult to understand and review

What about verification? Assertion-based modular reasoning becomes complicated due to non-local interactions – Floyd-Hoare morphs into Owicki-Gries Even with simple (finite) abstractions, the presence of concurrency makes the analysis computationally very expensive SequentialConcurrent Single Procedure P-timePSPACE-complete Multi Procedure P-timeUndecidable

What about testing? Number of executions = O( n nk ) Exponential in both n and k x = 1; … x = k; x = 1; … x = k; … Thread 1Thread n Scheduling nondeterminism Uncontrollable Unobservable Exponential

Concurrency is important More than ever before Increasing importance of communicating systems – networked devices – cyber-physical systems Distributed programs running on the cloud – EC2, Azure, AppEngine, … Parallel programs running on multicores and GPUs – TBB, TPL, CUDA, AMP, …

Concurrency testing with CHESS Deterministic scheduling – make scheduling choices observable and controllable Search prioritization – combating the combinatorial explosion of possible schedules

Deterministic scheduling Kernel: Threads, Scheduler, Synchronization Objects While(not done){ TestScenario() } TestScenario(){ … } Program CHESS Win32 API Tester Provides a Test Scenario CHESS runs the scenario in a loop Each run is a different interleaving Each run is repeatable

Search prioritization (I) Given p ≥ 0, generate all schedules with up to p preemptions Pseudo-polynomial number of schedules – polynomial in preemption bound and schedule points – exponential in number of threads Many bugs with fewer than 2 preemptions Simple error traces for easier debugging

Search prioritization (II) Given p ≥ 0 and deterministic schedulers S 0, …, S p-1, schedule according to S 0, …, S p-1 in sequence moving from one to next nondeterministically – e.g., round-robin non-preemptive scheduling with p different round-robin orders Polynomial number of schedules Testers can innovate by designing domain- specific deterministic schedulers

CHESS is available Used internally by Microsoft product groups and externally by Microsoft customers Binary and source code available at: –

Limitations of CHESS Exposing and gaining control of scheduling choices is difficult – most implementation effort and user frustration due to this problem Testing components that interact extensively with the environment is difficult Input coverage is not addressed

Static program exploration with Poirot Symbolic instead of concrete execution C: Source code for software component E: Model for environment and scheduler Explore behaviors of C+E – for all symbolic inputs – for all scheduling choices

Disk AsyncRead(…) { } DiskReader(…) { } DiskReader(…) { } headtail Request queueIn-memory cache cache cacheSize Demo: Asynchronous File I/O

Poirot architecture Trace Viewer Concurrent.NET Program Concurrent Boogie Program Coverage Report.NET  Boogie Concurrent C Program C  Boogie Corral

Sequentialization Stratified Search Error Trace Concurrent Boogie Program Sequential Boogie Program Coverage Report Searching with Corral Refinement Abstraction Concurrent Boogie Program

Abstraction Set of global variables G Set of tracked variables T Drop writes to variables in G-T Replace reads to variables in G-T with nondeterministic values

Sequentialization Stratified Search Error Trace Concurrent Boogie Program Sequential Boogie Program Coverage Report Searching with Corral Refinement Abstraction Concurrent Boogie Program

Refinement Path p – feasible if only variables in T are tracked – infeasible if all variables in G are tracked Expand tracked set T to U such that p infeasible while tracking only variables in U Naïve algorithm: linear scan of G-T New divide-and-conquer algorithm – best case log(|G-T|) – worst case 2*|G-T|

Sequentialization Stratified Search Error Trace Concurrent Boogie Program Sequential Boogie Program Coverage Report Searching with Corral Refinement Abstraction Concurrent Boogie Program

Sequentialization (I) Given a concurrent program P, construct a sequential program Q such that Q  P Drop each occurrence of async-call Convert each occurrence of async-call to call

Sequentialization (II) Given a concurrent program P, construct a family of programs Q i such that – Q 0  Q 1  Q 2  …  P –  i Q i = P Even better if interesting behaviors of P manifest in Q i for low values of i

Context-bounding Under-approximation parameterized by K ≥ 0 – executions in which each thread gets at most K contexts to execute As K  , we get all behaviors Can we create sequentializations for context- bounding?

Sequentializing context switches Shared Memory T1T1 T2T2 Local Memory Execution: T1T1 T2T2 T1T1 T2T2 T1T1 T1T1 T2T2 T1T1 (s 1, l 1 )(s 2, l 2 ) s2s2 l2l2

Guess and verify T1T1 T2T2 T1T1 (s 1, l 1 ) (s 2, l 2 )(s 3, l 2 ) Guess the effect of T 2 Verify the guess Make copies of global variables Source-to-source translation – linear in program size and K Generalizes to dynamically-created threads

Sequentialization Stratified Search Error Trace Concurrent Boogie Program Sequential Boogie Program Coverage Report Searching with Corral Refinement Abstraction Concurrent Boogie Program

Stratified search main … Call tree given recursion bound r VC(T) assert no bug Summaries(L) T L assert no bug VC(p) Convert loops to recursive calls

Poirot status Medium-sized C programs – up to 20K low-level systems code – reports precise traces at scale Small.NET programs – bytecode to Boogie translator in progress Try: Download available

Why bounded search? Data: Boolean, Integers, Arrays Control: Sequencing, Choice, Iteration, Call, Async-Call Sequencing Choice NP-complete Sequencing Choice Iteration Call Async-call Undecidable Sequencing Choice Iteration Call Async-call + bound Decidable PSPACE-hard Advances in SAT/SMT-solvers have made this problem tractable HAVOC verifier deployed for security analysis in Windows/IE Rationale: It is better to fail at the simpler problem!

Poirot collaborators Akash Lal, MSR Bangalore Shuvendu Lahiri, MSR Redmond

Questions