Advertisement

Certified Absence of Dangling Pointers in a Language with Explicit Deallocation

  • Javier de Dios
  • Manuel Montenegro
  • Ricardo Peña
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6396)

Abstract

Safe is a first-order eager functional language with facilities for programmer controlled destruction of data structures. It provides also regions, i.e. disjoint parts of the heap, where the program allocates data structures, so that the runtime system does not need a garbage collector. A region is a collection of cells, each one big enough to allocate a data constructor. Deallocating cells or regions may create dangling pointers. The language is aimed at inferring and certifying memory safety properties in a Proof Carrying Code like environment. Some of its analyses have been presented elsewhere. The one relevant to this paper is a type system and a type inference algorithm guaranteeing that well-typed programs will be free of dangling pointers at runtime.

Here we present how to generate formal certificates about the absence of dangling pointers property inferred by the compiler. The certificates are Isabelle/HOL proof scripts which can be proof-checked by this tool when loaded with a database of previously proved theorems. The key idea is proving an Isabelle/HOL theorem for each syntactic construction of the language, relating the static types inferred by the compiler to the dynamic properties about the heap that will be satisfied at runtime.

Keywords

Memory management type-based analysis formal certificates proof assistants 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Aspinall, D., Hofmann, M.: Another Type System for In-Place Update. In: Le Métayer, D. (ed.) ESOP 2002. LNCS, vol. 2305, pp. 36–52. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  2. 2.
    Aspinall, D., Hofmann, M., Konečný, M.: A Type System with Usage Aspects. Journal of Functional Programming 18(2), 141–178 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Barthe, G., Grégoire, B., Kunz, C., Rezk, T.: Certificate Translation for Optimizing Compilers. In: Yi, K. (ed.) SAS 2006. LNCS, vol. 4134, pp. 301–317. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  4. 4.
    Beringer, L., Hofmann, M., Momigliano, A., Shkaravska, O.: Automatic Certification of Heap Consumption. In: Baader, F., Voronkov, A. (eds.) LPAR 2004. LNCS (LNAI), vol. 3452, pp. 347–362. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  5. 5.
    Bornat, R.: Proving Pointer Programs in Hoare Logic. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 102–126. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  6. 6.
    de Dios, J., Peña, R.: A Certified Implementation on top of the Java Virtual Machine. In: Alpuente, M. (ed.) FMICS 2009. LNCS, vol. 5825, pp. 181–196. Springer, Heidelberg (2009)Google Scholar
  7. 7.
    de Dios, J., Peña, R.: Formal Certification of a Resource-Aware Language Implementation. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOL 2009. LNCS, vol. 5674, pp. 196–211. Springer, Heidelberg (2009)Google Scholar
  8. 8.
    Hofmann, M., Jost, S.: Static prediction of heap space usage for first-order functional programs. In: Proc. 30th ACM Symp. on Principles of Programming Languages, POPL 2003, pp. 185–197. ACM Press, New York (2003)Google Scholar
  9. 9.
    Luckham, D.C., Suzuki, N.: Verification of array, record and pointer operations in Pascal. ACM Trans. on Prog. Lang. and Systems 1(2), 226–244 (1979)CrossRefzbMATHGoogle Scholar
  10. 10.
    Mehta, F., Nipkow, T.: Proving Pointer Programs in Higher-Order Logic. In: Baader, F. (ed.) CADE 2003. LNCS (LNAI), vol. 2741, pp. 121–135. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  11. 11.
    Montenegro, M., Peña, R., Segura, C.: A Type System for Safe Memory Management and its Proof of Correctness. In: ACM Principles and Practice of Declarative Programming, PPDP 2008, Valencia, Spain, pp. 152–162 (July 2008)Google Scholar
  12. 12.
    Montenegro, M., Peña, R., Segura, C.: An Inference Algorithm for Guaranteeing Safe Destruction. In: Hanus, M. (ed.) LOPSTR 2008. LNCS, vol. 5438, pp. 135–151. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  13. 13.
    Montenegro, M., Peña, R., Segura, C.: A simple region inference algorithm for a first-order functional language. In: Escobar, S. (ed.) WFLP 2009. LNCS, vol. 5979, pp. 145–161. Springer, Heidelberg (2010)Google Scholar
  14. 14.
    Necula, G.C.: Proof-Carrying Code. In: ACM SIGPLAN-SIGACT Principles of Programming Languages, POPL 1997, pp. 106–119. ACM Press, New York (1997)Google Scholar
  15. 15.
    Necula, G.C., Lee, P.: Safe Kernel Extensions Without Run-Time Checking. In: Proceedings of the Second Symposium on Operating Systems Design and Implementation, Seattle, Washington, pp. 229–243 (October 1996)Google Scholar
  16. 16.
    Nipkow, T., Paulson, L., Wenzel, M.: Isabelle/HOL. A Proof Assistant for Higher-Order Logic. LNCS, vol. 2283. Springer, Heidelberg (2002)zbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Javier de Dios
    • 1
  • Manuel Montenegro
    • 1
  • Ricardo Peña
    • 1
  1. 1.Departamento de Sistemas Informáticos y ComputaciónUniversidad Complutense de MadridSpain

Personalised recommendations