Verifying Multi-threaded C Programs with SPIN

  • Authors:
  • Anna Zaks;Rajeev Joshi

  • Affiliations:
  • New York University,;Lab for Reliable Software, Jet Propulsion Laboratory,

  • Venue:
  • SPIN '08 Proceedings of the 15th international workshop on Model Checking Software
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

A key challenge in model checking software is the difficulty of verifying properties of implementation code, as opposed to checking an abstract algorithmic description. We describe a tool for verifying multi-threaded C programs that uses the SPIN model checker. Our tool works by compiling a multi-threaded C program into a typed bytecode format, and then using a virtual machine that interprets the bytecode and computes new program states under the direction of SPIN. Our virtual machine is compatible with most of SPIN's search options and optimization flags, such as bitstate hashing and multi-core checking. It provides support for dynamic memory allocation (the mallocand freefamily of functions), and for the pthreadlibrary, which provides primitives often used by multi-threaded C programs. A feature of our approach is that it can check code aftercompiler optimizations, which can sometimes introduce race conditions. We describe how our tool addresses the state space explosion problem by allowing users to define data abstraction functions and to constrain the number of allowed context switches. We also describe a reduction method that reduces context switches using dynamic knowledge computed on-the-fly, while being sound for both safety and liveness properties. Finally, we present initial experimental results with our tool on some small examples.