Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2594291.2594296acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Don't sweat the small stuff: formal verification of C code without the pain

Published: 09 June 2014 Publication History

Abstract

We present an approach for automatically generating provably correct abstractions from C source code that are useful for practical implementation verification. The abstractions are easier for a human verification engineer to reason about than the implementation and increase the productivity of interactive code proof. We guarantee soundness by automatically generating proofs that the abstractions are correct.
In particular, we show two key abstractions that are critical for verifying systems-level C code: automatically turning potentially overflowing machine-word arithmetic into ideal integers, and transforming low-level C pointer reasoning into separate abstract heaps. Previous work carrying out such transformations has either done so using unverified translations, or required significant proof engineering effort.
We implement these abstractions in an existing proof-producing specification transformation framework named AutoCorres, developed in Isabelle/HOL, and demonstrate its effectiveness in a number of case studies. We show scalability on multiple OS microkernels, and we show how our changes to AutoCorres improve productivity for total correctness by porting an existing high-level verification of the Schorr-Waite algorithm to a low-level C implementation with minimal effort.

References

[1]
E. Alkassar, M. Hillebrand, D. Leinenbach, N. Schirmer, and A. Starostin. The Verisoft approach to systems verification. In VSTTE 2008, volume 5295 of LNCS, pages 209--224. Springer, 2008.
[2]
A. Appel. Verified software toolchain. In 20th ESOP, volume 6602 of LNCS, pages 1--17. Springer, 2011.
[3]
T. Ball, E. Bounimova, R. Kumar, and V. Levin. SLAM2: Static driver verification with under 4% false alarms. In 2010 FMCAD, pages 35--42, Lugano, Switzerland, 2010. FMCAD Inc.
[4]
J. Bloch. Nearly all binary searches and mergesorts are broken. http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html, Jun 2006.
[5]
R. Bornat. Proving pointer programs in Hoare Logic. In 5th MPC, volume 1837 of LNCS, pages 102--126. Springer, Jul 2000.
[6]
A. Chlipala. The Bedrock structured programming system: combining generative metaprogramming and Hoare logic in an extensible program verifier. In 18th ICFP, pages 391--402. ACM, 2013.
[7]
D. Cock, G. Klein, and T. Sewell. Secure microkernels, state monads and scalable refinement. In 21st TPHOLs, volume 5170 of LNCS, pages 167--182, Montreal, Canada, Aug 2008. Springer.
[8]
E. Cohen, M. Dahlweid, M. Hillebrand, D. Leinenbach, M. Moskal, T. Santen, W. Schulte, and S. Tobies. VCC: A practical system for verifying concurrent C. In 22nd TPHOLs, volume 5674 of LNCS, pages 23--42, Munich, Germany, 2009. Springer.
[9]
C. Ellison and G. Roşu. An executable formal semantics of C with applications. In 39th POPL, pages 533--544. ACM, 2012.
[10]
D. Greenaway. Autocorres tool. http://ssrg.nicta.com.au/projects/TS/autocorres/, 2014.
[11]
D. Greenaway, J. Andronick, and G. Klein. Bridging the gap: Automatic verified abstraction of C. In 3rd ITP, volume 7406 of LNCS, pages 99--115, Princeton, New Jersey, Aug 2012. Springer.
[12]
T. A. Henzinger, R. Jhala, R. Majumdar, and G. Sutre. Software verification with Blast. In 10th SPIN, volume 2648 of LNCS, pages 235--239, Portland, OR, USA, May 2003. Springer.
[13]
T. Hubert and C. Marché. A case study of C source code verification: the Schorr-Waite algorithm. In 3rd Int. Conf. Softw. Engin. & Formal Methods, pages 190--199. IEEE, Sep 2005.
[14]
ISO/IEC. Programming languages --- C. Technical Report 9899:TC2, ISO/IEC JTC1/SC22/WG14, May 2005.
[15]
G. Klein, K. Elphinstone, G. Heiser, J. Andronick, D. Cock, P. Derrin, D. Elkaduwe, K. Engelhardt, R. Kolanski, M. Norrish, T. Sewell, H. Tuch, and S. Winwood. seL4: Formal verification of an OS kernel. In SOSP, pages 207--220, Big Sky, MT, USA, Oct 2009. ACM.
[16]
G. Klein, R. Kolanski, and A. Boyton. Mechanised separation algebra. In 3rd ITP, volume 7406 of LNCS, pages 332--337. Springer, 2012.
[17]
X. Leroy. Formal verification of a realistic compiler. CACM, 52(7): 107--115, 2009.
[18]
F. Mehta and T. Nipkow. Proving pointer programs in higher-order logic. In 19th CADE, volume 2741 of LNCS, pages 121--135, 2003.
[19]
Y. Moy. Automatic Modular Static Safety Checking for C Programs. PhD thesis, Université Paris-Sud, Paris, France, Jan 2009.
[20]
T. Murray, D. Matichuk, M. Brassil, P. Gammie, T. Bourke, S. Seefried, C. Lewis, X. Gao, and G. Klein. seL4: from general purpose to a proof of information flow enforcement. In IEEE Symp. Security & Privacy, pages 415--429, San Francisco, CA, May 2013.
[21]
T. Nipkow, L. Paulson, and M. Wenzel. Isabelle/HOL --- A Proof Assistant for Higher-Order Logic. Springer, 2002.
[22]
L. Noschinski, C. Rizkallah, and K. Mehlhorn. Verification of certifying computations through AutoCorres and Simpl. In NASA Formal Methods, volume 8430 of LNCS. Springer, 2014. To appear.
[23]
N. Schirmer. Verification of Sequential Imperative Programs in Isabelle/HOL. PhD thesis, Technische Universität München, 2006.
[24]
H. Schorr and W. M. Waite. An efficient machine-independent procedure for garbage collection in various list structures. CACM, 10 (8):501--506, 1967.
[25]
T. Sewell, M. Myreen, and G. Klein. Translation validation for a verified OS kernel. In 2013 PLDI, pages 471--481. ACM, 2013.
[26]
N. Suzuki. Automatic Verification of Programs with Complex Data Structures. Garland Publishing, New York, 1980.
[27]
H. Tuch, G. Klein, and M. Norrish. Types, bytes, and separation logic. In 34th POPL, pages 97--108, Nice, France, Jan 2007. ACM.
[28]
D. von Oheimb and T. Nipkow. Machine-checking the java specification: Proving type-safety. In Formal Syntax and Semantics of Java, volume 1523 of LNCS, pages 119--156. Springer, 1999.
[29]
X. Wang, H. Chen, A. Cheung, Z. Jia, N. Zeldovich, and M. F. Kaashoek. Undefined behavior: what happened to my code? In 3rd APSys, pages 9:1--9:7, New York, NY, USA, 2012. ACM.
[30]
S. Winwood, G. Klein, T. Sewell, J. Andronick, D. Cock, and M. Norrish. Mind the gap: A verification framework for low-level C. In 22nd TPHOLs, volume 5674 of LNCS, pages 500--515. Springer, 2009.

Cited By

View all
  • (2025)Generically Automating Separation Logic by Functors, Homomorphisms, and ModulesProceedings of the ACM on Programming Languages10.1145/37049039:POPL(1992-2024)Online publication date: 9-Jan-2025
  • (2025)Should We Balance? Towards Formal Verification of the Linux Kernel SchedulerStatic Analysis10.1007/978-3-031-74776-2_8(194-215)Online publication date: 21-Jan-2025
  • (2024)Verifying a C Implementation of Derecho’s Coordination Mechanism Using VST and CoqNASA Formal Methods10.1007/978-3-031-60698-4_6(99-117)Online publication date: 26-May-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PLDI '14: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation
June 2014
619 pages
ISBN:9781450327848
DOI:10.1145/2594291
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 49, Issue 6
    PLDI '14
    June 2014
    598 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2666356
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 09 June 2014

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. C verification
  2. Isabelle/HOL

Qualifiers

  • Research-article

Funding Sources

  • Australian Government

Conference

PLDI '14
Sponsor:

Acceptance Rates

PLDI '14 Paper Acceptance Rate 52 of 287 submissions, 18%;
Overall Acceptance Rate 406 of 2,067 submissions, 20%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)39
  • Downloads (Last 6 weeks)9
Reflects downloads up to 08 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Generically Automating Separation Logic by Functors, Homomorphisms, and ModulesProceedings of the ACM on Programming Languages10.1145/37049039:POPL(1992-2024)Online publication date: 9-Jan-2025
  • (2025)Should We Balance? Towards Formal Verification of the Linux Kernel SchedulerStatic Analysis10.1007/978-3-031-74776-2_8(194-215)Online publication date: 21-Jan-2025
  • (2024)Verifying a C Implementation of Derecho’s Coordination Mechanism Using VST and CoqNASA Formal Methods10.1007/978-3-031-60698-4_6(99-117)Online publication date: 26-May-2024
  • (2024)Formally Expressing What a Program Should Do: The ACSL LanguageGuide to Software Verification with Frama-C10.1007/978-3-031-55608-1_1(3-80)Online publication date: 10-Jul-2024
  • (2024)OpenBSD Formal Driver Verification with SeL4Innovative Security Solutions for Information Technology and Communications10.1007/978-3-031-52947-4_11(144-156)Online publication date: 21-Jan-2024
  • (2023)PancakeProceedings of the 12th Workshop on Programming Languages and Operating Systems10.1145/3623759.3624544(1-9)Online publication date: 23-Oct-2023
  • (2023)Dargent: A Silver Bullet for Verified Data Layout RefinementProceedings of the ACM on Programming Languages10.1145/35712407:POPL(1369-1395)Online publication date: 11-Jan-2023
  • (2023)Modeling and analysing Cyber–Physical Systems in HOL-CSPRobotics and Autonomous Systems10.1016/j.robot.2023.104549170:COnline publication date: 1-Dec-2023
  • (2023)Making an eBPF Virtual Machine Faster on Microcontrollers: Verified Optimization and Proof SimplificationDependable Software Engineering. Theories, Tools, and Applications10.1007/978-981-99-8664-4_22(385-401)Online publication date: 27-Nov-2023
  • (2022)VIP: verifying real-world C idioms with integer-pointer castsProceedings of the ACM on Programming Languages10.1145/34986816:POPL(1-32)Online publication date: 12-Jan-2022
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media