1 / 59

Crowfoot: a verifier for higher order store programs

Billiejoe (Nathaniel) Charlton Ben Horsfall Bernhard Reus University of Sussex. Crowfoot: a verifier for higher order store programs. VMCAI 2012. Outline. Background on Higher Order Store (HOS) What is HOS? Why should I care? Reasoning about HOS programs: Hoare logic with nested triples

warwick
Download Presentation

Crowfoot: a verifier for higher order store programs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Billiejoe (Nathaniel) Charlton Ben Horsfall Bernhard Reus University of Sussex Crowfoot: a verifier for higher order store programs VMCAI 2012

  2. Outline • Background on Higher Order Store (HOS) • What is HOS? Why should I care? • Reasoning about HOS programs: Hoare logic with nested triples • Automated reasoning in Hoare logics with nested triples • What are the difficulties? • How we address them in our Crowfoot tool • Some things we have verified using Crowfoot

  3. What is higher order store? • A programming language is said to feature HOS when: • a program’s code / commands / procedures are part of the mutable store which the program manipulates as it runs

  4. What is higher order store? • A programming language is said to feature HOS when: • a program’s code / commands / procedures are part of the mutable store which the program manipulates as it runs • So HOS programs can modify their own code while running

  5. What is higher order store? • A programming language is said to feature HOS when: • a program’s code / commands / procedures are part of the mutable store which the program manipulates as it runs • So HOS programs can modify their own code while running • Where does HOS occur? • in functional languages with mutable higher order state e.g. ML • dynamic loading and unloading of code e.g. Plugins, OSes • “hot update” – updating a program while it is running • runtime code generation

  6. square brackets indicate heap access

  7. square brackets indicate heap access stores procedure onto the heap, possibly doing partial application at the same time

  8. square brackets indicate heap access stores procedure onto the heap, possibly doing partial application at the same time runs the procedure stored in the heap at address , with arguments

  9. square brackets indicate heap access stores procedure onto the heap, possibly doing partial application at the same time ordinary procedure call runs the procedure stored in the heap at address , with arguments

  10. But what should we write here? We need to describe the code which must be stored on the heap at address f

  11. First attempt: says exactly which code is stored at f. But only allows us to invoke P if we’re adding 10! 

  12. Second attempt: better. But still not really satisfying. Doesn’t seem like a generic specification.

  13. Instead, we use a nested Hoare triple to talk about the behaviour of the code, rather than which exact code it is.

  14. Instead, we use a nested Hoare triple to talk about the behaviour of the code, rather than which exact code it is.

  15. Instead, we use a nested Hoare triple to talk about the behaviour of the code, rather than which exact code it is. Nested triples first appear in work by Honda, Yoshida and Berger; later developments by many others.

  16. Our tool Crowfoot • Our tool Crowfoot implements (semi-) automated verification of HOS programs, using nested triples • Employs symbolic execution with separation logic technique, as in Smallfoot, VeriFast, jStar ... • What issues did we face in implementing Crowfoot?

  17. Issues for implementation • Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible

  18. Assertion language

  19. Assertion language This is all circular! So triples can be nested to arbitrary depth.

  20. Issues for implementation • Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible • New symbolic execution rules for the HOS statements: those which write code to the heap, and invoke code stored on the heap

  21. Issues for implementation • Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible • New symbolic execution rules for the HOS statements: those which write code to the heap, and invoke code stored on the heap • Entailment prover for assertions involving nested triples

  22. Consider the following entailment between symbolic states:

  23. Consider the following entailment between symbolic states:

  24. Consider the following entailment between symbolic states: • We need to find c to make this entailment between specifications hold:

  25. Consider the following entailment between symbolic states: • We need to find c to make this entailment between specifications hold: • So, unlike in existing tools • Solving entailments between symbolic states requires solving entailments between specifications • And vice versa

  26. Issues for implementation • Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible • New symbolic execution rules for the HOS statements: those which write code to the heap, and invoke code stored on the heap • Entailment prover for assertions involving nested triples • Recursive specifications for programs which perform “recursion through the store”

  27. Issues for implementation • Assertion language: must include nested triples but still be restricted enough that automated reasoning is possible • New symbolic execution rules for the HOS statements: those which write code to the heap, and invoke code stored on the heap • Entailment prover for assertions involving nested triples • Recursive specifications for programs which perform “recursion through the store” • Implementing the deep frame rule

  28. Provers: the of Crowfoot • At its heart, crowfoot implements provers for five related judgements. • Symbolic execution:

  29. Provers: the of Crowfoot • At its heart, crowfoot implements provers for five related judgements. • Symbolic execution: predicate definitions, procedure context

  30. Provers: the of Crowfoot • At its heart, crowfoot implements provers for five related judgements. • Symbolic execution: • For example: predicate definitions, procedure context

  31. I maps existentially bound variables to appropriate instance Inferred frame • Entailment between symbolic states:

  32. I maps existentially bound variables to appropriate instance Inferred frame • Entailment between symbolic states: • For example:

  33. I maps existentially bound variables to appropriate instance Inferred frame • Entailment between symbolic states: • For example:

  34. I maps existentially bound variables to appropriate instance Inferred frame • Entailment between symbolic states: • For example: • Entailment between specifications: • For example:

  35. specification of routine about to be run • Computing the post-condition for a ‘call’ or ‘eval’: current symbolic state

  36. specification of routine about to be run • Computing the post-condition for a ‘call’ or ‘eval’: • For example: current symbolic state

  37. specification of routine about to be run • Computing the post-condition for a ‘call’ or ‘eval’: • For example: current symbolic state

  38. specification of routine about to be run • Computing the post-condition for a ‘call’ or ‘eval’: • For example: • Finding a nested triple to use with ‘eval’: current symbolic state current symbolic state address of code on heap to be run

  39. specification of routine about to be run • Computing the post-condition for a ‘call’ or ‘eval’: • For example: • Finding a nested triple to use with ‘eval’: • For example: current symbolic state current symbolic state address of code on heap to be run

  40. specification of routine about to be run • Computing the post-condition for a ‘call’ or ‘eval’: • For example: • Finding a nested triple to use with ‘eval’: • For example: current symbolic state current symbolic state address of code on heap to be run

  41. Two of the proof rules

  42. Recursion through the store • Recursion through the store is when code on the heap invokes itself through a pointer • Specifications for such code needs to appear in their own pre-conditions! • Crowfoot allows the declaration of such specifications:

More Related