skip to main content
10.1145/1375581.1375603acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Certifying low-level programs with hardware interrupts and preemptive threads

Authors Info & Claims
Published:07 June 2008Publication History

ABSTRACT

Hardware interrupts are widely used in the world's critical software systems to support preemptive threads, device drivers, operating system kernels, and hypervisors. Handling interrupts properly is an essential component of low-level system programming. Unfortunately, interrupts are also extremely hard to reason about: they dramatically alter the program control flow and complicate the invariants in low-level concurrent code (e.g., implementation of synchronization primitives). Existing formal verification techniques---including Hoare logic, typed assembly language, concurrent separation logic, and the assume-guarantee method---have consistently ignored the issues of interrupts; this severely limits the applicability and power of today's program verification systems.

In this paper we present a novel Hoare-logic-like framework for certifying low-level system programs involving both hardware interrupts and preemptive threads. We show that enabling and disabling interrupts can be formalized precisely using simple ownership-transfer semantics, and the same technique also extends to the concurrent setting. By carefully reasoning about the interaction among interrupt handlers, context switching, and synchronization libraries, we are able to---for the first time---successfully certify a preemptive thread implementation and a large number of common synchronization primitives. Our work provides a foundation for reasoning about interrupt-based kernel programs and makes an important advance toward building fully certified operating system kernels and hypervisors.

References

  1. William R. Bevier. Kit: A study in operating system verification. IEEE Trans. Softw. Eng., 15 (11): 1382--1396, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Richard Bornat, Cristiano Calcagno, Peter O'Hearn, and Matthew Parkinson. Permission accounting in separation logic. In Proc. 32nd ACM Symp. on Principles of Prog. Lang., pages 259--270, January 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Per Brinch Hansen. The programming language concurrent pascal. IEEE Trans. Software Eng., 1 (2): 199--207, 1975.Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Stephen Brookes. A semantics for concurrent separation logic. In Proc. 15th Int'l Conf. on Concurrency Theory (CONCUR'04), volume 3170 of LNCS, pages 16--34. Springer, September 2004.Google ScholarGoogle ScholarCross RefCross Ref
  5. Coq Development Team. The Coq proof assistant reference manual. The Coq release v8.1, 2006.Google ScholarGoogle Scholar
  6. Rober DeLine and Manual Fähndrich. Enforcing high-level protocols in low-level software. In Proc. 2001 ACM Conf. on Prog. Lang. Design and Impl., pages 59--69. ACM Press, June 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Xinyu Feng and Zhong Shao. Modular verification of concurrent assembly code with dynamic thread creation and termination. In Proc. 2005 ACM Int'l Conf. on Functional Prog., pages 254--267, September 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Xinyu Feng and Zhong Shao. Local reasoning and information hiding in SCAP. Technical Report YALEU/DCS/TR-1398, Dept. of Computer Science, Yale University, New Haven, CT, February 2008. http://flint.cs.yale.edu/publications/SCAPFrame.html.Google ScholarGoogle Scholar
  9. Xinyu Feng, Zhong Shao, Alexander Vaynberg, Sen Xiang, and Zhaozhong Ni. Modular verification of assembly code with stack-based control abstractions. In Proc. 2006 ACM Conf. on Prog. Lang. Design and Impl., pages 401--414. ACM Press, June 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Xinyu Feng, Rodrigo Ferreira, and Zhong Shao. On the relationship between concurrent separation logic and assume-guarantee reasoning. In Proc. 16th European Symp. on Prog. (ESOP'07), volume 4421 of LNCS, pages 173--188. Springer, March 2007a. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Feng, Ni, Shao, and Guo}feng07:ocapXinyu Feng, Zhaozhong Ni, Zhong Shao, and Yu Guo. An open framework for foundational proof-carrying code. In Proc. 2007 ACM Workshop on Types in Lang. Design and Impl., pages 67--78, January 2007b. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Xinyu Feng, Zhong Shao, Yuan Dong, and Yu Guo. Certifying low-level programs with hardware interrupts and preemptive threads. Technical Report YALEU/DCS/TR-1396 and Coq Implementations, Dept. of Computer Science, Yale University, New Haven, CT, November 2007c. http://flint.cs.yale.edu/publications/aim.html.Google ScholarGoogle Scholar
  13. Mauro Gargano, Mark A. Hillebrand, Dirk Leinenbach, and Wolfgang J. Paul. On the correctness of operating system kernels. In Proc. 18th Int'l Conf. on Theorem Proving in Higher Order Logics, volume 3603 of LNCS, pages 1--16, August 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Alexey Gotsman, Josh Berdine, Byron Cook, Noam Rinetzky, and Mooly Sagiv. Local reasoning for storable locks and threads. In Proc. 5th ASIAN Symp. on Prog. Lang. and Sys. (APLAS'07), pages 19--37, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. C. A. R. Hoare. An axiomatic basis for computer programming. Communications of the ACM, 26 (1): 53--56, October 1969. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. C. A. R. Hoare. Monitors: An operating system structuring concept. Communications of the ACM, 17 (10): 549--557, October 1974. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. C. A. R. Hoare. Towards a theory of parallel programming. In Operating Systems Techniques, pages 61--71. Academic Press, 1972.Google ScholarGoogle Scholar
  18. Aquinas Hobor, Andrew W. Appel, and Francesco Zappa Nardelli. Oracle semantics for concurrent separation logic. In Proc. 17th European Symp. on Prog. (ESOP'08), page to appear, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Galen C. Hunt and James R. Larus. Singularity design motivation. Technical Report MSR-TR-2004-105, Microsoft Corporation, December 2004.Google ScholarGoogle Scholar
  20. Samin S. Ishtiaq and Peter W. O'Hearn. BI as an assertion language for mutable data structures. In Proc. 28th ACM Symp. on Principles of Prog. Lang., pages 14--26. ACM Press, January 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Butler W. Lampson and David D. Redell. Experience with processes and monitors in Mesa. Commun. ACM, 23 (2): 105--117, 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Andrew McCreight, Zhong Shao, Chunxiao Lin, and Long Li. A general framework for certifying garbage collectors and their mutators. In Proc. 2007 ACM Conf. on Prog. Lang. Design and Impl., pages 468--479. ACM Press, June 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Greg Morrisett, David Walker, Karl Crary, and Neal Glew. From System F to typed assembly language. In Proc. 25th ACM Symp. on Principles of Prog. Lang., pages 85--97. ACM Press, January 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Zhaozhong Ni, Dachuan Yu, and Zhong Shao. Using XCAP to certify realistic systems code: Machine context management. In Proc. 20th Int'l Conf. on Theorem Proving in Higher Order Logics, volume 4421 of LNCS, pages 189--206. Springer, September 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Peter W. O'Hearn. Resources, concurrency and local reasoning. In Proc. 15th Int'l Conf. on Concurrency Theory (CONCUR'04), volume 3170 of LNCS, pages 49--67. Springer, September 2004.Google ScholarGoogle Scholar
  26. Peter W. O'Hearn, Hongseok Yang, and John C. Reynolds. Separation and information hiding. In Proc. 31th ACM Symp. on Principles of Prog. Lang., pages 268--280. ACM Press, January 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Jens Palsberg and Di Ma. A typed interrupt calculus. In Proc. 7th Int'l Symp. on Formal Tech. in Real-Time and Fault-Tolerant Sys. (FTRTFT'02), volume 2469 of LNCS, pages 291--310, September 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Wolfgang Paul, Manfred Broy, and Thomas In der Rieden. The Verisoft XT project. URL: http://www.verisoft.de, 2007.Google ScholarGoogle Scholar
  29. John Regehr and Nathan Cooprider. Interrupt verification via thread verification. Electron. Notes Theor. Comput. Sci., 174 (9), 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. John C. Reynolds. Separation logic: A logic for shared mutable data structures. In Proc. 17th Annual IEEE Symp. on Logic in Comp. Sci. (LICS'02), pages 55--74. IEEE Computer Society, July 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Kohei Suenaga and Naoki Kobayashi. Type based analysis of deadlock for a concurrent calculus with interrupts. In Proc. 16th European Symp. on Prog. (ESOP'07), volume 4421 of LNCS, pages 490--504, March 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Harvey Tuch, Gerwin Klein, and Gernot Heiser. OS verification -- now! In Proc. 10th Workshop on Hot Topics in Operating Systems, June 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Viktor Vafeiadis and Matthew Parkinson. A marriage of rely/guarantee and separation logic. In Proc. 18th Int'l Conf. on Concurrency Theory (CONCUR'07), volume 4703 of LNCS, pages 256--271, September 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Certifying low-level programs with hardware interrupts and preemptive threads

                      Recommendations

                      Comments

                      Login options

                      Check if you have access through your login credentials or your institution to get full access on this article.

                      Sign in
                      • Published in

                        cover image ACM Conferences
                        PLDI '08: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation
                        June 2008
                        396 pages
                        ISBN:9781595938602
                        DOI:10.1145/1375581
                        • General Chair:
                        • Rajiv Gupta,
                        • Program Chair:
                        • Saman Amarasinghe
                        • cover image ACM SIGPLAN Notices
                          ACM SIGPLAN Notices  Volume 43, Issue 6
                          PLDI '08
                          June 2008
                          382 pages
                          ISSN:0362-1340
                          EISSN:1558-1160
                          DOI:10.1145/1379022
                          Issue’s Table of Contents

                        Copyright © 2008 ACM

                        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 ACM 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]

                        Publisher

                        Association for Computing Machinery

                        New York, NY, United States

                        Publication History

                        • Published: 7 June 2008

                        Permissions

                        Request permissions about this article.

                        Request Permissions

                        Check for updates

                        Qualifiers

                        • research-article

                        Acceptance Rates

                        Overall Acceptance Rate406of2,067submissions,20%

                        Upcoming Conference

                        PLDI '24

                      PDF Format

                      View or Download as a PDF file.

                      PDF

                      eReader

                      View online with eReader.

                      eReader